Search Unity

GameObjects LifeTime Animation

Discussion in 'Animation' started by joihelgi, Sep 29, 2014.

  1. joihelgi

    joihelgi

    Joined:
    Jan 21, 2014
    Posts:
    19
    I am trying to create a gameObject that has lifetime, life of the gameObject decreases over time until it dies (deteriorates over time like a real creature), but it will be able to get a more life (time or %).

    I thought of creating an animation for the lifetime line, the animation will represent the deteriorate process in real time. When the gameObject gets more life, the animation will rewind the deteriorate process back the % or time it gets.

    I haven't found a simple way of rewinding the animation only some % or time back, and animate the rewinding process for like a one second, not just skipping back.

    Example:
    GameObject has an animation for the deterioration process that is 3 minutes long, if it dose not get more life it will only life for 3 minutes (the animation will trigger a function for the death). But if the gameObject has been living for 2 minutes (is has 33% life left) and gets a 1 more minute in life (33% more life), it will rewind the animation of the deterioration process back to 1 minute (now it has 66% life left), and this rewind animation will happen in two seconds (rewinds back 33% or 1 minute of life in two seconds).

    Any ideas for doing this the simple way will be appreciated! :)
     
  2. Mecanim-Dev

    Mecanim-Dev

    Joined:
    Nov 26, 2012
    Posts:
    1,675