public override void SetData(IEntityData data) { _data = (HeroData)data; base.SetData(data); if (data == null) { return; } gameObject.name = _data.Name + " (Hero)"; var mr = gameObject.GetComponentInChildren <MeshRenderer>(); if (mr != null) { mr.material = _data.Mat; } _abilitiable = new Abilitiable(gameObject, _data); _armorable = new Armorable(_data); _attackable = new Attackable(gameObject); _attackerable = new Attackerable(gameObject, _data); _healthable = new Healthable(gameObject, _data); _magicable = new Magicable(gameObject, _data); _movable = new Movable(gameObject, _data); _events = new MiscEvent(); _jobSystem = new JobSystem(gameObject); _teamable = new Teamable(gameObject); }
void dealDamage(Healthable healthable) { if (healthable) { healthable.TakeDamage(damageToDeal, gameObject); finishCollision(); } }
protected override void CreateComponents() { base.CreateComponents(); _armorable = new Armorable(this); _healthable = new Healthable(this); _teamable = new Teamable(this); _attackerable = new Attackerable(this, _teamable); _damageTarget = new Damageable(this, _healthable, _killable, _armorable); }
void OnCollisionEnter2D(Collision2D col) { Healthable healthable = col.gameObject.GetComponent <Healthable>(); if (healthable) { healthable.TakeDamage(9999, gameObject); } else if (col.gameObject.GetComponent <Bullet>()) { Destroy(col.gameObject); } }
// Use this for initialization void Awake() { if (!spriteRenderer) { spriteRenderer = GetComponent <SpriteRenderer>(); } if (!animator) { animator = GetComponent <Animator>(); } Healthable healthable = GetComponent <Healthable>(); }
protected override void CreateComponents() { base.CreateComponents(); _healthable = new Healthable(this); _magicable = new Magicable(this); _armorable = new Armorable(this); _killable = new Killable(this); _damageTarget = new Damageable(this, _healthable, _killable); _teamable = new Teamable(this); _attackerable = new Attackerable(this, _teamable); _aggroable = new Aggroable(this, _teamable); var agent = GetComponent <NavMeshAgent>(); var obstacle = GetComponent <NavMeshObstacle>(); _movable = new Movable(this, agent, obstacle); }
protected override void CreateComponents() { base.CreateComponents(); _abilitiable = new Abilitiable(this); _armorable = new Armorable(this); _healthable = new Healthable(this); _magicable = new Magicable(this); _teamable = new Teamable(this); _attackerable = new Attackerable(this, _teamable); var agent = GetComponent <NavMeshAgent>(); var obstacle = GetComponent <NavMeshObstacle>(); _movable = new Movable(this, agent, obstacle); _targetable = new Targetable(this); _killable = new Killable(this); _damageTarget = new Damageable(this, _healthable, _killable, _armorable); _modifiable = new Modifiable(this); _inventoryable = new Inventoryable <IItem>(this, new LimitedInventory <IItem>(6)); _healable = new Healable(this, _healthable); }
void Start() { Healthable healthable = GetComponent <Healthable>(); }