Example #1
0
 public virtual void Use(entity_data source, Transform target = null)
 {
     // // default : key feather
     // if (target?.gameObject.layer == game_variables.Instance.LayerInteract)
     // {
     //     print(gameObject.name + " : " + target.GetComponent<base_interact>().TryAction(transform));
     //     // if (target.GetComponent<base_interact>().TryAction(transform) == 2)
     //     // {
     //     //     // source.SetEquipped(null);
     //     //     // * testing consume
     //     //     // gameObject.SetActive(false);
     //     //     // if (_destroy)
     //     //     // print("huh");
     //     //     Destroy();
     //     //     // else
     //     //     // HealthDrain(1);
     //     // }
     //     // else
     //     //     print("wut");
     // }
     // if (_destroy)
     //     Destroy();
     // else
     HealthDrain(1);
 }
Example #2
0
 public override void Use(entity_data source, Transform target = null)
 {
     // print(target);
     if (target == _valid)
     {
         Destroy();
     }
 }
Example #3
0
 public override void Use(entity_data source, Transform target = null)
 {
     if (target?.gameObject.layer == game_variables.Instance.LayerPlayer || target?.gameObject.layer == game_variables.Instance.LayerMob)
     {
         // source.SetEquipped(null);
         // target.GetComponent<entity_data>().AmmoModify(_type, _amount);
         // gameObject.SetActive(false);
         HealthDrain(1);
     }
     // else
     //     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
 }
Example #4
0
 public override void Use(entity_data source, Transform target = null)
 {
     if (target?.gameObject.layer == game_variables.Instance.LayerPlayer || target?.gameObject.layer == game_variables.Instance.LayerMob)
     {
         Collider2D[] colliders = Physics2D.OverlapCircleAll(transform.position, _radiusEffect, game_variables.Instance.ScanLayerMob);
         foreach (Collider2D collider in colliders)
         {
             // * testing
             collider.GetComponent <controller_mob>().RegisterEvent(transform.position, game_variables.Instance.LayerPlayer, Time.time);
         }
     }
     // else
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
 }
 // [Tooltip("Delay before destroy")] [SerializeField] protected float _time = 0f;
 // [Tooltip("false - instantiate | true - set active")] [SerializeField] protected bool _parent = false;
 // protected float _timer;
 // public override void Load()
 // {
 //     _timer = -1f;
 // }
 // void Update()
 // protected override void Update()
 // {
 //     base.Update();
 //     // if (_timer > 0)
 //     //     _timer -= Time.deltaTime;
 //     // else if (_timer != -1)
 //     //     Destroy();
 //     // if (_uses == 0)
 //     //     _timer = _time;
 //     // base.Update();
 //     if (_uses == 0)
 //         Destroy();
 // }
 public override void Use(entity_data source, Transform target = null)
 {
     // if (target.gameObject.layer == game_variables.Instance.LayerPlayer || target.gameObject.layer == game_variables.Instance.LayerMob)
     // {
     if (_effect)
     {
         Instantiate(_effect, transform.position, transform.rotation).GetComponent <base_hitbox>().Initialize(source.transform);
     }
     // if (_uses != -1)
     //     _uses--;
     HealthDrain(1);
     // }
     // else
     //     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
 }
Example #6
0
 public override void Use(entity_data source, Transform target = null)
 {
     if (source?.gameObject.layer == game_variables.Instance.LayerPlayer)
     {
         source.CollectibleModify(_id, _amount);
         // controller_player.Instance.Data.Drop(this as base_item);
         Destroy();
         // HealthDrain(1);
         // base.Use(source, target);
     }
     // // indestructible...
     // HealthDrain(1);
     // ...hence
     // else
     //     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
 }
Example #7
0
 protected virtual void Awake()
 {
     // ??? post initialize
     if (_host)
     {
         _data  = _host.GetComponent <entity_data>();
         _motor = _host.GetComponent <entity_motor>();
         _anim  = _host.GetChild(0).GetComponent <entity_anim>();
     }
     _timerPath = 0f;
     // else
     // {
     //     // * testing
     //     _host = transform;
     //     _data = _host.GetComponent<entity_data>();
     //     _motor = _host.GetComponent<entity_motor>();
     // }
 }
 public override void Use(entity_data source, Transform target = null)
 {
     if (target?.gameObject.layer == game_variables.Instance.LayerPlayer || target?.gameObject.layer == game_variables.Instance.LayerMob)
     {
         // source.SetEquipped(null);
         target.GetComponent <entity_data>()?.HealthRestore(_amount);
         HealthDrain(1);
     }
     else if (source?.gameObject.layer == game_variables.Instance.LayerPlayer || source?.gameObject.layer == game_variables.Instance.LayerMob)
     {
         // source.SetEquipped(null);
         source.GetComponent <entity_data>()?.HealthRestore(_amount);
         HealthDrain(1);
     }
     // else
     //     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
     _uses = _healthInst;
 }
 public override void Use(entity_data source, Transform target = null)
 {
     if (_charge < 1f)
     {
         return;
     }
     // if (target.gameObject.layer == game_variables.Instance.LayerPlayer || target.gameObject.layer == game_variables.Instance.LayerMob)
     // {
     // source.SetEquipped(null);
     Instantiate(_hitbox, transform.position, transform.rotation).GetComponent <base_hitbox>().Initialize(source.transform);
     // gameObject.SetActive(false);
     // HealthDrain(1);
     _charge--;
     // }
     // print("Use " + gameObject.name + ":" + source);
     // else
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
 }
Example #10
0
 void OnTriggerExit2D(Collider2D other)
 {
     if (other.gameObject.layer == game_variables.Instance.LayerChunk)
     {
         return;
     }
     if (other.gameObject.layer == game_variables.Instance.LayerPlayer || other.gameObject.layer == game_variables.Instance.LayerMob)
     {
         entity_data temp = other.GetComponent <entity_data>();
         if (_targets.Contains(temp))
         {
             _targets.Remove(temp);
         }
         else
         {
             return;
         }
     }
 }
 void Awake()
 {
     _data = GetComponent <entity_data>();
     _anim = transform.GetChild(0).GetComponent <entity_anim>();
     _rb   = GetComponent <Rigidbody2D>();
     //
     _path        = null;
     _targetIndex = 0;
     _spawn       = Position;
     _move        = _spawn;
     //
     _cache = Vector2.zero;
     // _modifiersDrag = new List<float>();
     // _modifiersSpeed = new List<float>();
     _modifierDrag  = 1f;
     _modifierSpeed = 1f;
     _active        = new List <Vector2>();
     // _direction = Vector2.zero;
     // _anchor = Instantiate(new GameObject(), transform.position + _offset, transform.rotation);
 }
 public override void Use(entity_data source, Transform target = null)
 {
     if (target?.gameObject.layer == game_variables.Instance.LayerPlayer || target?.gameObject.layer == game_variables.Instance.LayerMob)
     {
         // source.SetEquipped(null);
         if (target == _valid)
         {
             target.GetComponent <entity_data>().HealthDrain();
         }
         else
         {
             Transform temp = Instantiate(_stink, target.position, target.rotation).transform;
             temp.SetParent(target);
             temp.GetComponent <base_hitbox>().Initialize(source.transform);
         }
         // gameObject.SetActive(false);
         HealthDrain(1);
     }
     // else
     //     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
     //     feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
 }
Example #13
0
 public override void Use(entity_data source, Transform target = null)
 {
     // if (target.gameObject.layer == game_variables.Instance.LayerPlayer || target.gameObject.layer == game_variables.Instance.LayerMob)
     // {
     if (source.IsCollectible(_type))
     {
         for (int i = 0; i < _amount; i++)
         {
             Instantiate(_hitbox, transform.position, Quaternion.Euler(0f, 0f, transform.eulerAngles.z + (_spread / (float)_amount) * (i - Mathf.FloorToInt(_amount / 2)))).GetComponent <base_hitbox>().Initialize(source.transform);
         }
         source.CollectibleModify(_type, -1);
         _uses = source.GetCollectible(_type);
     }
     else
     {
         feedback_popup.Instance.RegisterMessage(source.transform, "*click*", game_variables.Instance.ColorDefault, .5f);
     }
     // }
     // else
     //     base.Use(target, source);
     // feedback_toaster.Instance.RegisterMessage(gameObject.name + " : invalid target", game_variables.Instance.ColorDefault);
     // feedback_popup.Instance.RegisterMessage(source.transform, "invalid target", game_variables.Instance.ColorDefault);
 }