private IEnumerator RoundEnding()
    {
        // Stop tanks from moving.
        DisableTankControl();

        // Clear the winner from the previous round.
        m_GameWinner = null;

        // See if there is a winner now the round is over.
        // If there is a winner, increment their score.
        m_GameWinner = GetRoundWinner();

        // Now the winner's score has been incremented, see if someone has one the game.
        //m_GameWinner = GetGameWinner ();

        // Get a message based on the scores and whether or not there is a game winner and display it.
        string message = EndMessage();

        if (m_GameWinner != null || time > 93)
        {
            m_MessageText.text = message;
            SceneManager.LoadScene(15);
            time = 0f;
        }

        // Wait for the specified length of time until yielding control back to the game loop.
        yield return(m_EndWait);
    }
Beispiel #2
0
 protected override void Start()
 {
     tank = GetComponent <TankPlay>();
     if (tank == null)
     {
         throw new System.Exception("TankPlay Script was not implement!!");
     }
 }
Beispiel #3
0
    // Use this for initialization
    void Start()
    {
        GameObject nameTag = Instantiate(Battlemanager.ins.nameTagPrefab);

        //Debug.Log(tankname);
        //Debug.Log(nameTag);
        nameTag.GetComponent <CameraFollower>().target = transform;
        nameTag.transform.position = transform.position;
        nameTag.transform.Find("Text").GetComponent <Text>().text = tankname;
        tank          = GetComponent <TankPlay>();
        tank.tankName = tankname;
        tank.nameTag  = nameTag;
        if (randomColor)
        {
            color = new Color(Random.value, Random.value, Random.value);
        }
        flag.color = color;
    }
Beispiel #4
0
    void OnTriggerEnter2D(Collider2D coll)
    {
        TankPlay tp = coll.gameObject.GetComponent <TankPlay>();

        if (tp != null)
        {
            if (tp.team != team)
            {
                //Debug.Log(string.Format("{0}/{1} Hitted eme!!",tp.team,team));
                tp.HP -= 5;
            }
            else
            {
                return;
            }
        }
        //Debug.Log("Hitted!!");

        Disable();
    }