public void AssembleMotor(UnitStateType state, UnitAsset asset, Rigidbody rb, UnitAnimation animation) { m_state = state; m_asset = asset; m_speed = m_asset.Speed(); m_rotSpeed = m_asset.RotSpeed(); m_altitude = m_asset.Altitude(); m_rb = rb; m_animation = animation; }
public void AssembleHealth(UnitStateType state, UnitAsset asset, UnitBuilder builder, UnitAnimation animation) { m_asset = asset; m_state = state; m_builder = builder; m_animation = animation; m_isPlayer = m_asset.IsPlayer(); m_pool = m_asset.ObjectPoolAsset(); m_faction = m_asset.Faction(); m_playerHealthChangeEvent = m_asset.UnitHealthChangeEvent(); m_playerDeathEvent = m_asset.UnitDeathEvent(); }
private void GetComponents() { m_collider = GetComponent <BoxCollider>(); if (!m_collider) { Debug.Log("no collider on " + gameObject.name); m_collider = gameObject.AddComponent <BoxCollider>(); } m_rb = GetComponent <Rigidbody>(); if (!m_rb) { Debug.Log("no rb on " + gameObject.name); m_rb = gameObject.AddComponent <Rigidbody>(); } m_collisions = GetComponent <UnitCollisions>(); if (!m_collisions) { Debug.Log("no unitCollisions on " + gameObject.name); m_collisions = gameObject.AddComponent <UnitCollisions>(); } componentStates.Add(m_collisions); m_brain = GetComponent <UnitBrain>(); if (!m_brain) { Debug.Log("no brains on " + gameObject.name); m_brain = gameObject.AddComponent <UnitBrain>(); } componentStates.Add(m_brain); m_motor = GetComponent <UnitMotor>(); if (!m_motor) { Debug.Log("no motor on " + gameObject.name); m_motor = gameObject.AddComponent <UnitMotor>(); } componentStates.Add(m_motor); m_health = GetComponent <UnitHealth>(); if (!m_health) { Debug.Log("no health on " + gameObject.name); m_health = gameObject.AddComponent <UnitHealth>(); } componentStates.Add(m_health); m_weapons = GetComponent <UnitWeapons>(); if (!m_weapons) { Debug.Log("no weps on " + gameObject.name); m_weapons = gameObject.AddComponent <UnitWeapons>(); } componentStates.Add(m_weapons); m_animation = GetComponent <UnitAnimation>(); if (!m_animation) { Debug.Log("no animator on " + gameObject.name); m_animation = gameObject.AddComponent <UnitAnimation>(); } componentStates.Add(m_animation); }