protected virtual void Start()
 {
     //Set max health
     maxHealth = health;
     movable   = GetComponent <IMovable>();
     movement  = GetComponent <ISpeedable>();
 }
 // we need to remove blocks which makes impossible for player to traverse through gate.
 //We make them all prepared after first creation in Gate class
 private void OnTriggerEnter(Collider other)
 {
     if (!IsPrepared)
     {
         IRotatable player = other.GetComponentInParent <IRotatable>();
         if (player == null)
         {
             return;
         }
         IsPrepared = true;
         Disable();
     }
     else
     {
         ISpeedable playerSpeed = other.GetComponentInParent <ISpeedable>();
         if (playerSpeed == null)
         {
             return;
         }
         _isMoved  = true;
         _startPos = transform.position;
         playerSpeed.SlowDown();
         _rb.isKinematic = false;
         _rb.AddForce(Vector3.right, ForceMode.Impulse);
     }
 }
Example #3
0
            private void OnTriggerEnter(Collider other)
            {
                ISpeedable player = other.GetComponentInParent <ISpeedable>();

                if (player != null)
                {
                    player.Stop();
                    LevelProgress.Instance.FinishGame();
                }
            }
Example #4
0
    protected virtual void OnTriggerEnter2D(Collider2D other)
    {
        target = other.transform.root.GetComponent <ISpeedable>();

        //Hit the target if it is damageable
        if (target != null)
        {
            target.SpeedEffect(speedBoost, effectTime);
            Destroy(gameObject);
        }
    }
Example #5
0
    private void OnTriggerEnter(Collider other)
    {
        ISpeedable player = other.GetComponentInParent <ISpeedable>();

        if (player == null)
        {
            return;
        }
        player.SpeedUp();
        gameObject.SetActive(false);
    }
Example #6
0
 public Fan(string name, string location, int speedInPercent)
     : base(name, location)
 {
     _percentSpeed = new PercentSpeed(speedInPercent);
 }