コード例 #1
0
    private void RpcGivePointToTeam(byte team)
    {
        if (!isServer)
        {
            if (team == 0)
            {
                ScorePointA++;
            }
            else
            {
                ScorePointB++;
            }
        }
        if (ScorePointA == 1 && team == 0)
        {
            players = ClientScene.objects;
            foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> entry in players)
            {
                if (entry.Value.isLocalPlayer)
                {
                    ClientScene.FindLocalObject(entry.Key).GetComponent <VoiceActing>().PointCaptured(team);
                }
            }
            //team0 vann första pointen
        }
        if (ScorePointB == 1 && team == 1)
        {
            players = ClientScene.objects;
            foreach (KeyValuePair <NetworkInstanceId, NetworkIdentity> entry in players)
            {
                if (entry.Value.isLocalPlayer)
                {
                    ClientScene.FindLocalObject(entry.Key).GetComponent <VoiceActing>().PointCaptured(team);
                }
            }
            //team1 vann första pointen
        }
        domCanvas.enabled = false;
        //GetComponent<MeshRenderer>().enabled = false;
        GetComponent <CapsuleCollider>().enabled = false;
        //transform.position = new Vector3(50f, -1.65f, 31f);
        //objectivesWon.text = "A= " + ScorePointA + " / " + "B= " + ScorePointB;
        if (ScorePointA == 1)
        {
            Point1TeamA.SetActive(true);
        }
        if (ScorePointA == 2)
        {
            Point2TeamA.SetActive(true);
        }

        if (ScorePointB == 1)
        {
            Point1TeamB.SetActive(true);
        }
        if (ScorePointB == 2)
        {
            Point2TeamB.SetActive(true);
        }
    }
コード例 #2
0
    private void Start()
    {
        domMat    = animatedDom.GetComponent <MeshRenderer>().material;
        maskImage = domCanvas.transform.GetChild(0).GetComponent <Image>();
        rnd       = new System.Random(System.DateTime.Now.Millisecond);

        Point1TeamA.SetActive(false);
        Point2TeamA.SetActive(false);
        Point1TeamB.SetActive(false);
        Point2TeamB.SetActive(false);

        for (int i = 0; i < dominationPads.Length; i++)
        {
            DominationPadInfo info = new DominationPadInfo();
            info.pos        = dominationPads[i].position;
            info.icon       = dominationPads[i].GetComponent <Image>();
            info.listNumber = (byte)i;
            padList.Add(info);
        }
        GetComponent <CapsuleCollider>().enabled = false;
        sp = new StatePointer(StartState);
        //objectivesWon.text = "A= " + ScorePointA + " / " + "B= " + ScorePointB;


        domMat.SetFloat("_NeutralEvent", 1f);
        OwnerImage.color   = NoneOwned;
        MiddleCircle.color = NoneOwned;
    }