Esempio n. 1
0
    public void CommunismEnhancement()
    {
        if (!m_IsCommunismed)
        {
            m_Chassis.transform.localScale   += new Vector3(0.6f, 0, 0.4f);
            m_Turret.transform.localScale    += new Vector3(0.4f, 0, 0.4f);
            m_Barrel.transform.localPosition += new Vector3(0.35f, 0, 0.2f);
            m_SecondBarrel = Instantiate(m_Barrel, m_Tank) as GameObject;
            m_SecondBarrel.transform.localPosition = m_Barrel.transform.localPosition - new Vector3(0.7f, 0, 0);
            tankShooting TKScript = gameObject.GetComponent <tankShooting>();
            TKScript.SetCommunismTrue();

            tankControl TKCcontroller = gameObject.GetComponent <tankControl>();
            TKCcontroller.SetSpeed(m_CMSpeed);

            tankHealth THScript = gameObject.GetComponent <tankHealth>();
            THScript.AddHealth(m_CMAddAmount);
            Rigidbody m_rigidbody = GetComponent <Rigidbody>();
            m_rigidbody.mass += m_CMIncreaseMass;

            m_IsCommunismed = true;
        }
        else
        {
            tankHealth tkHp = gameObject.GetComponent <tankHealth>();
            tkHp.RegenerateHealth(20f);
        }
    }
Esempio n. 2
0
    private void OnTriggerEnter(Collider other)
    {
        int playerMask = (int)Mathf.Floor(Mathf.Log(LayerMask.GetMask("PlayerLayer"), 2f));

        if (other.gameObject.CompareTag("Player"))
        {
            tankHealth tkHealth = other.gameObject.GetComponent <tankHealth>();
            tkHealth.RegenerateHealth(m_RegenerateAmount);
            Destroy(gameObject);
        }
    }