Exemple #1
0
//----------------------------------------------------------------------------------
// Preparing element to be animated on enabling
public void PrepareAnimations () {
    initialAnimation = startAnimation;
  
    switch (initialAnimation) {
        case StartAnimation.none:
            currentPosition = position;
        break;
    
        case StartAnimation.move_from_left:
            currentPosition = new Vector2(0-size.x, position.y);
        break;
    
        case StartAnimation.move_from_right:
            currentPosition = new Vector2(parentSize.x+size.x, position.y);
        break;
    
        case StartAnimation.move_from_top:
            currentPosition = new Vector2(position.x, 0-size.y);
        break;
    
        case StartAnimation.move_from_bottom:
            currentPosition = new Vector2(position.x, parentSize.y+size.y);
        break;
    }
}
Exemple #2
0
//----------------------------------------------------------------------------------
// Preparing element to be animated on enabling
    public void PrepareAnimations()
    {
        initialAnimation = startAnimation;

        switch (initialAnimation)
        {
        case StartAnimation.none:
            currentPosition = position;
            break;

        case StartAnimation.move_from_left:
            currentPosition = new Vector2(0 - size.x, position.y);
            break;

        case StartAnimation.move_from_right:
            currentPosition = new Vector2(parentSize.x + size.x, position.y);
            break;

        case StartAnimation.move_from_top:
            currentPosition = new Vector2(position.x, 0 - size.y);
            break;

        case StartAnimation.move_from_bottom:
            currentPosition = new Vector2(position.x, parentSize.y + size.y);
            break;
        }
    }
 private void PlayStartAnimation(int speed)
 {
     if (startAnimationName != "")
     {
         if (speed < 0)
         {
             StartAnimation[startAnimationName].time = StartAnimation[startAnimationName].length;
         }
         StartAnimation[startAnimationName].speed = speed;
         StartAnimation.Play(startAnimationName);
     }
 }
 // Update is called once per frame
 void Update()
 {
     if (Cardboard.SDK.Triggered)
     {
         gameObject.GetComponent<Rigidbody>().velocity = new Vector3(0, 0, -5);
         ani = GameObject.Find("CardboardHead").GetComponent<StartAnimation>();
         ani.flag = true;
         //GameObject mExplosion = Instantiate(explosion);
         //Destroy(mExplosion, 3);
         Destroy(gameObject);
        // Application.LoadLevelAsync("Main");
     }
 }
Exemple #5
0
 // Update is called once per frame
 void Update()
 {
     if (Cardboard.SDK.Triggered)
     {
         gameObject.GetComponent <Rigidbody>().velocity = new Vector3(0, 0, -5);
         ani      = GameObject.Find("CardboardHead").GetComponent <StartAnimation>();
         ani.flag = true;
         //GameObject mExplosion = Instantiate(explosion);
         //Destroy(mExplosion, 3);
         Destroy(gameObject);
         // Application.LoadLevelAsync("Main");
     }
 }
Exemple #6
0
//----------------------------------------------------------------------------------
// Animate element if animation specified
    public void Update()
    {
        if (initialAnimation != StartAnimation.none)
        {
            switch (initialAnimation)
            {
            case StartAnimation.move_from_left:
                currentPosition.x += Time.deltaTime * animationSpeed;
                if (currentPosition.x >= position.x)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_right:
                currentPosition.x -= Time.deltaTime * animationSpeed;
                if (currentPosition.x <= position.x)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_top:
                currentPosition.y += Time.deltaTime * animationSpeed;
                if (currentPosition.y >= position.y)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_bottom:
                currentPosition.y -= Time.deltaTime * animationSpeed;
                if (currentPosition.y <= position.y)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;
            }
        }
    }
Exemple #7
0
 /// <summary>
 ///		Ejecuta las acciones de una línea de tiempo
 /// </summary>
 internal void Execute(TimeLineModel timeLine)
 {
     // Si no existía ninguna animación se crea
     if (_animationProcessor == null)
     {
         // Crea el objeto
         _animationProcessor = new TimeLineProcessor(this, UseAnimation);
         // Asigna los manejadores de eventos
         _animationProcessor.AnimationStart += (sender, evntArgs) =>
         {
             StartAnimation?.Invoke(this, EventArgs.Empty);
             IsPlayingAnimation = true;
         };
         _animationProcessor.AnimationEnd += (sender, evntArgs) =>
         {
             EndAnimation?.Invoke(this, EventArgs.Empty);
             IsPlayingAnimation = false;
         };
     }
     // Ejecuta la animación
     _animationProcessor.Execute(timeLine);
 }
Exemple #8
0
    //----------------------------------------------------------------------------------
    // Animate element if animation specified
    void Update()
    {
        if (this.gameObject.tag == "MineSweeperOptions") {
            Debug.Log(Elements[1].caption);
            controller.gameObject.GetComponent<MoveOnScript>().col = Int32.Parse(Elements[1].parameter);
            controller.gameObject.GetComponent<MoveOnScript>().row = Int32.Parse(Elements[0].parameter);
            controller.gameObject.GetComponent<MoveOnScript>().dens = Int32.Parse(Elements[2].parameter);
        }
          if (initialAnimation!=StartAnimation.none)
           {
         switch (initialAnimation)
          {
        case StartAnimation.move_from_left:
         currentPosition.x += Time.deltaTime * animationSpeed;
         if  (currentPosition.x >= position.x)
           {
               initialAnimation=StartAnimation.none;
               currentPosition = position;
           }
        break;

        case StartAnimation.move_from_right:
         currentPosition.x -= Time.deltaTime * animationSpeed;
         if  (currentPosition.x <= position.x)
           {
               initialAnimation=StartAnimation.none;
               currentPosition = position;
           }
        break;

        case StartAnimation.move_from_top:
         currentPosition.y += Time.deltaTime * animationSpeed;
         if  (currentPosition.y >= position.y)
           {
               initialAnimation=StartAnimation.none;
               currentPosition = position;
           }
        break;

        case StartAnimation.move_from_bottom:
         currentPosition.y -= Time.deltaTime * animationSpeed;
         if  (currentPosition.y <= position.y)
           {
               initialAnimation=StartAnimation.none;
               currentPosition = position;
           }
        break;

          }
        windowRect = new Rect( currentPosition.x, currentPosition.y, size.x, size.y) ;
        }

           if (Elements.Length>0)
         for (int i=0; i<Elements.Length; i++) Elements[i].Update();

           if (actionToPerform!=Action.none)
          if(parentElement)
            {
              parentElement.SetAction(actionToPerform);
              //actionToPerform = Action.none;
            }

           if (actionToPerform == Action.close)
          if(!parentElement)
             {
              this.enabled = false;
              actionToPerform = Action.none;
             }
    }
Exemple #9
0
    //----------------------------------------------------------------------------------
    // Align element and  setup start position/animation
    void OnEnable()
    {
        if (this.gameObject.tag == "MineSweeperOptions") {
            controller = GameObject.FindGameObjectWithTag("MenuMover");
        }
          initialAnimation = startAnimation;

         if (Elements.Length>0)
           for (int i=0; i<Elements.Length; i++)
        Elements[i].PrepareAnimations();

          switch (globalAligment)
          {
        case Aligments.center_center:
        position.x = (Screen.width-size.x)/2;
        position.y = (Screen.height-size.y)/2;
          break;

        case Aligments.center_up:
        position.x = (Screen.width-size.x)/2;
        position.y = 0;
          break;

        case Aligments.center_down:
        position.x = (Screen.width-size.x)/2;
        position.y = Screen.height-size.y;
          break;

        case Aligments.left_center:
        position.x = 0;
        position.y = (Screen.height-size.y)/2;
          break;

        case Aligments.left_up:
        position.x = 0;
        position.y = 0;
          break;

        case Aligments.left_down:
        position.x = 0;
        position.y = Screen.height-size.y;
          break;

        case Aligments.right_center:
        position.x = Screen.width-size.x;
        position.y = (Screen.height-size.y)/2;
          break;

        case Aligments.right_up:
        position.x = Screen.width-size.x;
        position.y = 0;
          break;

        case Aligments.right_down:
        position.x = Screen.width-size.x;
        position.y = Screen.height-size.y;
          break;

         case Aligments.left:
        position.x = 0;
          break;

        case Aligments.center_y:
        position.x = (Screen.height-size.y)/2;
        position.y = (Screen.height-size.y)/2;
          break;

        case Aligments.center_x:
        position.x = (Screen.width-size.x)/2;
          break;

        case Aligments.right:
        position.x = Screen.width-size.x;
          break;

        case Aligments.down:
        position.y = Screen.height-size.y;
          break;

        case Aligments.up:
        position.y = 0;
          break;
          }

          switch (initialAnimation)
          {
           case StartAnimation.none:
         currentPosition = position;
        break;

        case StartAnimation.move_from_left:
         currentPosition = new Vector2(0-size.x, position.y);
        break;

        case StartAnimation.move_from_right:
         currentPosition = new Vector2(Screen.width+size.x, position.y);
        break;

        case StartAnimation.move_from_top:
         currentPosition = new Vector2(position.x, 0-size.y);
        break;

        case StartAnimation.move_from_bottom:
         currentPosition = new Vector2(position.x, Screen.height+size.y);
        break;
          }

           if (scrollViewSize == Vector2.zero)   scrollViewSize = size;

           windowRect = new Rect( currentPosition.x, currentPosition.y, size.x, size.y) ;
    }
Exemple #10
0
//----------------------------------------------------------------------------------
// Animate element if animation specified
public void Update () {

    if (initialAnimation != StartAnimation.none) {
        switch (initialAnimation) {
            case StartAnimation.move_from_left:
                currentPosition.x += Time.deltaTime * animationSpeed;
                if (currentPosition.x >= position.x) {
                    initialAnimation = StartAnimation.none;
                    currentPosition = position;
                }
                break;

            case StartAnimation.move_from_right:
                currentPosition.x -= Time.deltaTime * animationSpeed;
                if (currentPosition.x <= position.x) {
                    initialAnimation = StartAnimation.none;
                    currentPosition = position;
                }
                break;

            case StartAnimation.move_from_top:
                currentPosition.y += Time.deltaTime * animationSpeed;
                if (currentPosition.y >= position.y) {
                    initialAnimation = StartAnimation.none;
                    currentPosition = position;
                }
                break;

            case StartAnimation.move_from_bottom:
                currentPosition.y -= Time.deltaTime * animationSpeed;
                if (currentPosition.y <= position.y) {
                    initialAnimation = StartAnimation.none;
                    currentPosition = position;
                }
                break;
        }
    }
}
Exemple #11
0
//----------------------------------------------------------------------------------
// Animate element if animation specified
void Update () 
{

  if (initialAnimation!=StartAnimation.none)
   {
     switch (initialAnimation)
	  {
	    case StartAnimation.move_from_left:
	     currentPosition.x += Time.deltaTime * animationSpeed;
	     if  (currentPosition.x >= position.x) 
	       {
		       initialAnimation=StartAnimation.none;
		       currentPosition = position;
	       }
	    break;
	    
	    case StartAnimation.move_from_right:
	     currentPosition.x -= Time.deltaTime * animationSpeed;
	     if  (currentPosition.x <= position.x)  
	       {
		       initialAnimation=StartAnimation.none;
		       currentPosition = position;
	       }
	    break;
	    
	    case StartAnimation.move_from_top:
	     currentPosition.y += Time.deltaTime * animationSpeed;
	     if  (currentPosition.y >= position.y)  
	       {
		       initialAnimation=StartAnimation.none;
		       currentPosition = position;
	       }
	    break;
	    
	    case StartAnimation.move_from_bottom:
	     currentPosition.y -= Time.deltaTime * animationSpeed;
	     if  (currentPosition.y <= position.y)  
	       {
		       initialAnimation=StartAnimation.none;
		       currentPosition = position;
	       }
	    break;

	  }
	    windowRect = new Rect( currentPosition.x, currentPosition.y, size.x, size.y) ;
	}
	
	
   if (Elements.Length>0)
     for (int i=0; i<Elements.Length; i++) Elements[i].Update();
  
   if (actionToPerform!=Action.none) 
          if(parentElement) 
            {
              parentElement.SetAction(actionToPerform);
              //actionToPerform = Action.none;
            }
          
   if (actionToPerform == Action.close) 
          if(!parentElement) 
             {
              this.enabled = false;
              actionToPerform = Action.none;
             }
          

}
Exemple #12
0
//----------------------------------------------------------------------------------
// Animate element if animation specified
    void Update()
    {
        if (this.gameObject.tag == "MineSweeperOptions")
        {
            Debug.Log(Elements[1].caption);
            controller.gameObject.GetComponent <MoveOnScript>().col  = Int32.Parse(Elements[1].parameter);
            controller.gameObject.GetComponent <MoveOnScript>().row  = Int32.Parse(Elements[0].parameter);
            controller.gameObject.GetComponent <MoveOnScript>().dens = Int32.Parse(Elements[2].parameter);
        }
        if (initialAnimation != StartAnimation.none)
        {
            switch (initialAnimation)
            {
            case StartAnimation.move_from_left:
                currentPosition.x += Time.deltaTime * animationSpeed;
                if (currentPosition.x >= position.x)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_right:
                currentPosition.x -= Time.deltaTime * animationSpeed;
                if (currentPosition.x <= position.x)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_top:
                currentPosition.y += Time.deltaTime * animationSpeed;
                if (currentPosition.y >= position.y)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;

            case StartAnimation.move_from_bottom:
                currentPosition.y -= Time.deltaTime * animationSpeed;
                if (currentPosition.y <= position.y)
                {
                    initialAnimation = StartAnimation.none;
                    currentPosition  = position;
                }
                break;
            }
            windowRect = new Rect(currentPosition.x, currentPosition.y, size.x, size.y);
        }


        if (Elements.Length > 0)
        {
            for (int i = 0; i < Elements.Length; i++)
            {
                Elements[i].Update();
            }
        }

        if (actionToPerform != Action.none)
        {
            if (parentElement)
            {
                parentElement.SetAction(actionToPerform);
                //actionToPerform = Action.none;
            }
        }

        if (actionToPerform == Action.close)
        {
            if (!parentElement)
            {
                this.enabled    = false;
                actionToPerform = Action.none;
            }
        }
    }
Exemple #13
0
//----------------------------------------------------------------------------------
// Align element and  setup start position/animation
    void OnEnable()
    {
        if (this.gameObject.tag == "MineSweeperOptions")
        {
            controller = GameObject.FindGameObjectWithTag("MenuMover");
        }
        initialAnimation = startAnimation;

        if (Elements.Length > 0)
        {
            for (int i = 0; i < Elements.Length; i++)
            {
                Elements[i].PrepareAnimations();
            }
        }

        switch (globalAligment)
        {
        case Aligments.center_center:
            position.x = (Screen.width - size.x) / 2;
            position.y = (Screen.height - size.y) / 2;
            break;

        case Aligments.center_up:
            position.x = (Screen.width - size.x) / 2;
            position.y = 0;
            break;

        case Aligments.center_down:
            position.x = (Screen.width - size.x) / 2;
            position.y = Screen.height - size.y;
            break;

        case Aligments.left_center:
            position.x = 0;
            position.y = (Screen.height - size.y) / 2;
            break;

        case Aligments.left_up:
            position.x = 0;
            position.y = 0;
            break;

        case Aligments.left_down:
            position.x = 0;
            position.y = Screen.height - size.y;
            break;

        case Aligments.right_center:
            position.x = Screen.width - size.x;
            position.y = (Screen.height - size.y) / 2;
            break;

        case Aligments.right_up:
            position.x = Screen.width - size.x;
            position.y = 0;
            break;

        case Aligments.right_down:
            position.x = Screen.width - size.x;
            position.y = Screen.height - size.y;
            break;

        case Aligments.left:
            position.x = 0;
            break;

        case Aligments.center_y:
            position.x = (Screen.height - size.y) / 2;
            position.y = (Screen.height - size.y) / 2;
            break;

        case Aligments.center_x:
            position.x = (Screen.width - size.x) / 2;
            break;

        case Aligments.right:
            position.x = Screen.width - size.x;
            break;

        case Aligments.down:
            position.y = Screen.height - size.y;
            break;

        case Aligments.up:
            position.y = 0;
            break;
        }


        switch (initialAnimation)
        {
        case StartAnimation.none:
            currentPosition = position;
            break;

        case StartAnimation.move_from_left:
            currentPosition = new Vector2(0 - size.x, position.y);
            break;

        case StartAnimation.move_from_right:
            currentPosition = new Vector2(Screen.width + size.x, position.y);
            break;

        case StartAnimation.move_from_top:
            currentPosition = new Vector2(position.x, 0 - size.y);
            break;

        case StartAnimation.move_from_bottom:
            currentPosition = new Vector2(position.x, Screen.height + size.y);
            break;
        }


        if (scrollViewSize == Vector2.zero)
        {
            scrollViewSize = size;
        }

        windowRect = new Rect(currentPosition.x, currentPosition.y, size.x, size.y);
    }