예제 #1
0
 // Use this for initialization
 void Start()
 {
     if (isServer)
     {
         progresses.Add(0f);
         progresses.Add(0f);
         progresses.Add(0f);
         progresses.Add(0f);
     }
 }
예제 #2
0
        public void SyncListFloatTest()
        {
            SyncListFloat serverList = new SyncListFloat();
            SyncListFloat clientList = new SyncListFloat();

            serverList.Add(1.0F);
            serverList.Add(2.0F);
            serverList.Add(3.0F);
            SerializeDeltaTo(serverList, clientList);

            Assert.That(clientList, Is.EquivalentTo(new[] { 1.0F, 2.0F, 3.0F }));
        }
        void Start()
        {
            var animator = GetComponent <Animator>();

            if (animator != null && animator.avatar != null)
            {
                m_Avatar      = animator.avatar;
                m_PoseHandler = new HumanPoseHandler(m_Avatar, transform);
                m_PoseHandler.GetHumanPose(ref m_NextPose);
                m_PoseHandler.GetHumanPose(ref m_PreviousPose);
                m_PoseHandler.GetHumanPose(ref m_CurrentPose);

                m_InitialBodyPosition = m_CurrentPose.bodyPosition;
                m_InitialBodyRotation = m_CurrentPose.bodyRotation;

                m_SynchronizeMusclesCount = m_NextPose.muscles.Length;
                if (isServer)
                {
                    for (int i = 0; i < m_SynchronizeMusclesCount; i++)
                    {
                        muscles.Add(0.0f);
                        muscles_half.Add(0);
                    }
                }
            }
        }
예제 #4
0
 public override void InitBoard(int playersCount)
 {
     base.InitBoard(playersCount);
     for (int x = 0; x < maxTries; ++x)
     {
         timers.Add((Random.value * maxTime) + timerOffset);
     }
     boardInstruction = "Tap on white";             // todo: l10n
 }
예제 #5
0
    public void CommSyncStart(NetworkManager mgr)
    {
        NetMgr   = mgr;
        syncBall = true;

        // Only bother with x and z (can expand later)
        syncData = new SyncListFloat();

        if (mgr.IsServer())
        {
            syncData.Add(StoredPosition.x);
            syncData.Add(StoredPosition.z);
            syncData.Add(Direction.x);
            syncData.Add(Direction.z);
        }
        else
        {
            syncData.Callback = this.OnDataChanged;
        }
    }
예제 #6
0
    private void CmdContabilizarVolta(string s)
    {
        Debug.Log(s);

        if (s == "p")
        {
            controladorJogo.AlterarPosicionamento();

            return;
        }

        try
        {
            voltas = int.Parse(s);

            if (!controladorJogo.jogoIniciado || voltas < 0)
            {
                return;
            }

            if (voltas > 0)
            {
                float tempoVolta = controladorJogo.tempoServidor - controladorJogo.tempoInicioCorrida;

                if (tempoVoltas.Count < voltas)
                {
                    tempoVoltas.Add(tempoVolta);
                }
                else
                {
                    tempoVoltas[voltas] = tempoVolta;
                }
            }

            if (voltas == 0)
            {
                controladorJogo.IniciarCorrida();
            }
            else if (voltas == controladorJogo.voltasTotal)
            {
                if (controladorJogo.vencedorDeclarado)
                {
                    AtualizarJogador();
                    controladorJogo.EncerrarCorrida();
                }
                else
                {
                    controladorJogo.DeclararVencedor(idJogador);
                }
            }
        }
        catch (FormatException) { }
    }
예제 #7
0
    public void GetPlayStats()
    {
        if (isServer)
        {
            GameObject myParent = gameObject.transform.parent.gameObject;

            NetworkedStatsScript[] allPlayStats = myParent.GetComponentsInChildren <NetworkedStatsScript> ();



            for (int i = playerID.Count; i < allPlayStats.Length; i++)
            {
                gpas.Add(allPlayStats [i].myGPA);
                standings.Add(allPlayStats [i].myStanding);
                playerID.Add(allPlayStats [i].playerID);
                pNames.Add(allPlayStats [i].pName);
            }
        }
    }
예제 #8
0
파일: XPMaster.cs 프로젝트: atahan-git/DotT
 public void SetUp()
 {
     for (int i = 0; i < 3; i++)
     {
         level.Add(0);
     }
     for (int i = 0; i < 3; i++)
     {
         xp.Add(0);
     }
     for (int i = 0; i < 3; i++)
     {
         reqXp.Add(0);
     }
     for (int i = 0; i < 3; i++)
     {
         xp_percent.Add(0);
     }
 }
예제 #9
0
    void Start()
    {
        babies.Callback += OnBabiesListUpdated;
        if (isServer)
        {
            GameObject newM = (GameObject)Instantiate(mommaPrefab, mStartPosition.position, mStartPosition.rotation);
            NetworkServer.Spawn(newM);
            momma = newM;

            GameObject newCB = (GameObject)Instantiate(cBPrefab, cbStartPosition.position, cbStartPosition.rotation);
            NetworkServer.Spawn(newCB);
            colorBall = newCB;
            SetBallColor(Color.red);
            cbColor = Color.red;

            for (int i = 0; i < 5; i++)
            {
                floatTester.Add(0);
            }
        }
    }
예제 #10
0
    public void RandomizePanel()
    {
        // Place the controls 'randomly'.
        pvgPub.DoPlaceButton();

        for (int btnIdx = 0; btnIdx < pvgPub.listOfButtons.Length; btnIdx++)
        {
            ButtonVisualAspect curButton = pvgPub.listOfButtons[btnIdx];
            posList.Add(curButton.transform.localPosition.x);
            posList.Add(curButton.transform.localPosition.y);
            posList.Add(curButton.GetComponent <Control>().subType);
            curButton.GetComponent <Control>().offSprite = curButton.GetComponent <Control>().controlSprites[curButton.GetComponent <Control>().subType].offSprite;
            curButton.GetComponent <Control>().onSprite  = curButton.GetComponent <Control>().controlSprites[curButton.GetComponent <Control>().subType].onSprite;
        }
    }