Esempio n. 1
0
        public void OnTriggerEnter2D(Collider2D col)
        {
            if (col.CompareTag("Player"))
            {
                PlayerCharacter player = GameManager.Instance.player;
                if (!player.liveWireMovement.enabled)
                {
                    return;
                }
                player.transform.position = transform.position;
                boxCollider.enabled       = false;
                disableTimer = delay;

                if (Directions2D.areOppositeDirections(backwardDirection, player.rb.velocity))
                {
                    player.liveWireMovement.SetDirection(forwardDirection);
                }
                else if (Directions2D.areOppositeDirections(forwardDirection, player.rb.velocity))
                {
                    player.liveWireMovement.SetDirection(backwardDirection);
                }
                else
                {
                    player.liveWireMovement.SetDirection(forwardDirection);
                }
            }
        }
Esempio n. 2
0
 public void Awake()
 {
     direction   = Directions2D.toVector(motionDirection);
     boxCollider = GetComponent <BoxCollider2D>();
 }
Esempio n. 3
0
 // Start is called before the first frame update
 void Awake()
 {
     forwardDirection  = Directions2D.toVector(forwardMotionDirection);
     backwardDirection = Directions2D.toVector(backwardMotionDirection);
     boxCollider       = GetComponent <BoxCollider2D>();
 }