void spawnResource() { GameObject obj = Instantiate(m_resource_prefab, Vector3Calc.randomDirection() * 8f, Quaternion.identity); obj.GetComponent <Resource>().Initalize(RandomCalc.Rand(new Range <float>(10f, 100f))); ObjectLogger.log(obj, "RESOURCE"); }
public void Initalize(Vector2 p_direction, float p_damage, GameObject p_shooter) { m_rb = gameObject.GetComponent <Rigidbody2D>(); m_standard_velocity = p_direction * m_speed; m_damage = p_damage; m_shooter = p_shooter; ObjectLogger.log(gameObject, "BULLET"); m_timeout = new TimeoutEventManager(); m_timeout.addTimeout(2f, () => { ObjectLogger.unlog(gameObject, "BULLET"); Destroy(gameObject); }); }
//---------------------------------------------------------- //Construction public void Initialize(MindBodyDNDNA <ResourceFightDNCreature> p_dna, ResourceFightGameController p_controller) { m_is_initialized = true; ObjectLogger.log(gameObject, "CREATURE"); m_dna = p_dna.Clone(); MindBodyDN mindbody = p_dna.express(this); m_traits = mindbody.m_body; InitializeBrain(mindbody.m_mind); m_health = new LimitedNumber(m_traits["HEALTH"] * 5); m_energy = new LimitedNumber(m_traits["ENERGY"] * 10); m_speed = m_traits["SPEED"]; m_damage = m_traits["DAMAGE"]; m_attack_speed = m_traits["ATTACKSPEED"]; m_controller = p_controller; }