public void AssembleBrain(UnitStateType state, UnitMotor motor, UnitAsset asset) { m_state = state; m_motor = motor; m_asset = asset; m_isPlayer = m_asset.IsPlayer(); m_terrainVars = m_asset.TerrainVars(); m_targetIndicator = m_asset.TargetIndicator(); m_currentTurn = 0f; }
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); }