Ejemplo n.º 1
0
 protected void MoveLeftRight()
 {
     switch(direction)
     {
     case PlatformDirection.left:
         if(traveledDistance > this.distance)
         {
             this.transform.MoveRight(speed);
             direction = PlatformDirection.right;
         }
         else
         {
             this.transform.MoveLeft(speed);
         }
         break;
     case PlatformDirection.right:
         if(traveledDistance > this.distance)
         {
             this.transform.MoveLeft(speed);
             direction = PlatformDirection.left;
         }
         else
         {
             this.transform.MoveRight(speed);
         }
         break;
     }
 }
Ejemplo n.º 2
0
 protected void MoveUpDown()
 {
     switch(direction)
     {
     case PlatformDirection.up:
         if(traveledDistance > this.distance)
         {
             this.transform.MoveDown(speed);
             direction = PlatformDirection.down;
         }
         else
         {
             this.transform.MoveUp(speed);
         }
         break;
     case PlatformDirection.down:
         if(traveledDistance > this.distance)
         {
             this.transform.MoveUp(speed);
             direction = PlatformDirection.up;
         }
         else
         {
             this.transform.MoveDown(speed);
         }
         break;
     }
 }
Ejemplo n.º 3
0
 protected void MoveForwardBackward()
 {
     switch(direction)
     {
     case PlatformDirection.foward:
         if(traveledDistance > this.distance)
        	{
             this.transform.MoveBack(speed);
             direction = PlatformDirection.backward;
         }
         else
         {
             this.transform.MoveFoward(speed);
         }
         break;
     case PlatformDirection.backward:
         if(traveledDistance > this.distance)
         {
             this.transform.MoveFoward(speed);
             direction = PlatformDirection.foward;
         }
         else
         {
             this.transform.MoveBack(speed);
         }
         break;
     }
 }