Beispiel #1
0
    // Use this for initialization
    void Start()
    {
        Application.runInBackground = true;
        IC             = this.GetComponent <ItemsController>();
        Timer          = GameObject.Find("Timer").GetComponent <Text>();
        Notify         = GameObject.Find("Notify").GetComponent <Text>();
        RedTeam        = GameObject.Find("R").GetComponent <Text>();
        BlueTeam       = GameObject.Find("B").GetComponent <Text>();
        RedScore       = GameObject.Find("RedScore").GetComponent <Text>();
        BlueScore      = GameObject.Find("BlueScore").GetComponent <Text>();
        RP1HP          = GameObject.Find("RP1HP").GetComponent <Slider>();
        RP2HP          = GameObject.Find("RP2HP").GetComponent <Slider>();
        RP3HP          = GameObject.Find("RP3HP").GetComponent <Slider>();
        BP1HP          = GameObject.Find("BP1HP").GetComponent <Slider>();
        BP2HP          = GameObject.Find("BP2HP").GetComponent <Slider>();
        BP3HP          = GameObject.Find("BP3HP").GetComponent <Slider>();
        RedSlide       = GameObject.Find("RedScoreSlider").GetComponent <Slider>();
        BlueSlide      = GameObject.Find("BlueScoreSlider").GetComponent <Slider>();
        Notify.enabled = false;
        //HUDScript.NotifyPoints("red",);
        currentGameState = GameState.Ready;
        HUDScript.ChangeTeamName(team.red, rl.classname);
        HUDScript.ChangeTeamName(team.blue, bl.classname);



        for (int i = 0; i < rl.classname.Length; i++)
        {
            myNumber += (int)rl.classname[i];
        }
        for (int i = 0; i < bl.classname.Length; i++)
        {
            myNumber += (int)bl.classname[i];
        }



        /*if (RedTeamScored == null)
         *  RedTeamScored = new UnityEvent();
         * if (BlueTeamScored == null)
         *  BlueTeamScored = new UnityEvent();
         * RedTeamScored.AddListener(nullPing);
         * BlueTeamScored.AddListener(nullPing);*/
        InvokeRepeating("gameTimerCountdown", 0.0f, 1.0f);

        if (GameOver == null)
        {
            GameOver = new UnityEvent();
        }
        GameOver.AddListener(nullPing);
        DamageB1.AddListener(nullping);
        DamageB2.AddListener(nullping);
        DamageB3.AddListener(nullping);
        DamageR1.AddListener(nullping);
        DamageR2.AddListener(nullping);
        DamageR3.AddListener(nullping);

        //Debug.Log(BlueTeam3);
        BlueTeam1.addDyingListener(B1Died);
        BlueTeam2.addDyingListener(B2Died);
        BlueTeam3.addDyingListener(B3Died);

        RedTeam1.addDyingListener(R1Died);
        RedTeam2.addDyingListener(R2Died);
        RedTeam3.addDyingListener(R3Died);

        BlueTeam1.addHitListener(HUDScript.PlayerHit);
        BlueTeam2.addHitListener(HUDScript.PlayerHit);
        BlueTeam3.addHitListener(HUDScript.PlayerHit);
        RedTeam1.addHitListener(HUDScript.PlayerHit);
        RedTeam2.addHitListener(HUDScript.PlayerHit);
        RedTeam3.addHitListener(HUDScript.PlayerHit);

        BlueTeam1.addShotListener(shoot);
        BlueTeam2.addShotListener(shoot);
        BlueTeam3.addShotListener(shoot);
        RedTeam1.addShotListener(shoot);
        RedTeam2.addShotListener(shoot);
        RedTeam3.addShotListener(shoot);

        BlueTeam1.addActionListener(someonePerformed);
        BlueTeam2.addActionListener(someonePerformed);
        BlueTeam3.addActionListener(someonePerformed);
        RedTeam1.addActionListener(someonePerformed);
        RedTeam2.addActionListener(someonePerformed);
        RedTeam3.addActionListener(someonePerformed);

        objective0.addObjectiveListener(ObjectiveSecured);
        objective1.addObjectiveListener(ObjectiveSecured);
        objective2.addObjectiveListener(ObjectiveSecured);
    }