Esempio n. 1
0
 // void Update()
 protected virtual void Update()
 {
     // remove dead
     if (_hostiles.Count > 0)
     {
         List<Transform> toRemove = new List<Transform>();
         foreach (Transform hostile in _hostiles)
             if (!hostile || !hostile.gameObject.activeSelf)
                 toRemove.Add(hostile);
         foreach (Transform hostile in toRemove)
             _hostiles.Remove(hostile);
     }
     // * testing ? duplicate
     if (_equipped)
     {
         _motor.SetModifierSpeed(_equipped.Modifier);
         // _motor.AddModifierDrag(_equipped.Modifier);
         // // * testing auto drop
         // if (!_equipped.gameObject.activeSelf)
         //     SetEquipped(null, false);
     }
     // 
     if (_timerIframes > 0f)
         _timerIframes -= Time.deltaTime;
     // * testing iframe flicker
     _anim.SetFlicker(_timerIframes > 0f);
     // _motor.CollidersToggle(false);
     _anim.SetColor(_invisible ? game_variables.Instance.ColorDefault : game_variables.Instance.ColorEntity);
 }
 // void Update()
 // {
 //     // * testing
 //     if (_sprite)
 //         // _sprite.enabled = Vector3.Distance(transform.position, controller_player.Instance.Motor.Position) <= game_variables.Instance.RadiusSprite;
 //         _sprite.enabled =  game_camera.Instance.InView(transform.position);
 // }
 private void OnTriggerStay2D(Collider2D other)
 {
     if (other.gameObject.layer == game_variables.Instance.LayerPlayer)
     {
         entity_motor temp = other.GetComponent <entity_motor>();
         // controller_player temp = other.GetComponent<controller_player>();
         if (_drag > 0f)
         {
             // player_motor.Instance.ModifierDrag = _drag;
             temp.SetModifierDrag(_drag);
         }
         if (_speed > 0f)
         {
             temp.SetModifierSpeed(_speed);
         }
         if (_force.sqrMagnitude > 0)
         {
             temp.AddForce(_force);
         }
     }
 }