public virtual bool Register <T>(T module) { if (module is IInit) { IInit v = (IInit)module; v.Init(); } if (module is IUpdate) { IUpdate v = (IUpdate)module; if (!m_UpdateList.Contains(v)) { m_UpdateList.Add(v); } } if (module is IDestroy) { IDestroy v = (IDestroy)module; if (!m_DestroyList.Contains(v)) { m_DestroyList.Add(v); } } return(true); }
public virtual bool Remove <T>(T module) { if (module is IUpdate) { IUpdate v = (IUpdate)module; m_UpdateList.Remove(v); } if (module is IDestroy) { IDestroy v = (IDestroy)module; m_DestroyList.Remove(v); } return(true); }
public override void Drink(object obj) { IDestroy destroyObject = obj as IDestroy; if (destroyObject != null) { //TODO: переделать //destroyObject.currentHealtPoint += addingHealthPoints; Variables.player.currentHealtPoint += (Variables.player.maxHealthPoint - Variables.player.currentHealtPoint > addingHealthPoints) ? addingHealthPoints : Variables.player.maxHealthPoint - Variables.player.currentHealtPoint; } else { EventLog.doEvent("Нельзя выпить", ConsoleColor.White); } }
private void Awake() { _spawn = GetComponent <ISpawn>(); _destroy = GetComponent <IDestroy>(); _difficulty = GetComponent <IDifficulty>(); }
public void DoAttack(IDestroy mapObject) { int damage = GetDamage(); mapObject.SetDamage(damage); }