private void Setup() { m_GameManager = FindObjectOfType <SimpleGameManager>(); m_Self = new TankComponents { m_Health = GetComponent <SimpleTankHealth>(), m_Movement = GetComponent <SimpleTankMovement>(), m_Shooting = GetComponent <SimpleTankShooting>(), m_RayPerception = GetComponent <RayPerception>() }; GameObject[] players = GameObject.FindGameObjectsWithTag("Player"); for (int i = 0; i < players.Length; i++) { if (GameObject.ReferenceEquals(players[i], this.gameObject)) { continue; } else { m_Other = new TankComponents { m_Health = players[i].GetComponent <SimpleTankHealth>(), m_Movement = players[i].GetComponent <SimpleTankMovement>(), m_Shooting = players[i].GetComponent <SimpleTankShooting>(), m_RayPerception = players[i].GetComponent <RayPerception>() }; } } // Init values lastOtherHealth = m_Other.m_Health.m_StartingHealth; lastSelfHealth = m_Self.m_Health.m_StartingHealth; }
public void Init(TankComponents _tankComponents, Camera _mainCamera) { tankComponents = _tankComponents; mainCamera = _mainCamera; }