Ejemplo n.º 1
0
    public static void setObjects(object[] objects, SyncPlayer sp)
    {
        ClassControl cc = sp.GetComponent <ClassControl> ();

        cc.switchedAt.setPlayerTriggerTime((float)objects [2]);

        if (cc.whichUnlock != (byte)objects [0])
        {
            cc.enableUnlockEquippedRegardlessOfSwitching(false);
            cc.whichUnlock = (byte)objects [0];
            if (cc.whichUnlock == (byte)objects [1])               // This is because of SetNextUnlock
            {
                cc.enableUnlockEquippedRegardlessOfSwitching(true);
            }
        }

        if (cc.nextUnlock != (byte)objects [1])
        {
            cc.SetNextUnlock((byte)objects [1], false, false);
        }

        if (!cc.isSwitching())
        {
            Unlock unlock = cc.getUnlockEquipped();
            if (unlock != null)
            {
                unlock.firedAt.setPlayerTriggerTime((float)objects [3]);
                unlock.secondaryFiredAt.setPlayerTriggerTime((float)objects [4]);
                unlock.reloadedAt.setPlayerTriggerTime((float)objects [5]);
                unlock.equippedAt.setPlayerTriggerTime((float)objects [6]);
                if (unlock is GunScript && ((GunScript)unlock).isReloadableType())
                {
                    ((GunScript)unlock).NumShots = (byte)objects [7];
                }
            }
        }
        int team     = sp.GetComponent <Combat> ().team;
        int classNum = sp.GetComponent <ClassControl> ().classNum;

        if (classNum == 0)
        {
            sp.GetComponent <PlayerMove> ().movementAbilityCoolDownStartedAt = (float)objects[8];
            if (team == 0)
            {
                cc.getUnlockEquippedWithType <PlaceShield> ().coolDownStartedAt = (float)objects [9];
            }
            else if (Player.thisPlayer)
            {
                Player.thisPlayer.trapCoolDownsStartedAt [0] = (float)objects [9];
                Player.thisPlayer.trapCoolDownsStartedAt [1] = (float)objects [10];
            }
        }
        else if (classNum == 1)
        {
            cc.getUnlockEquippedWithType <PlaceIcicle> ().coolDownStartedAt = (float)objects[8];
            cc.getUnlockEquippedWithType <PlaceIcicle> ().AmmoStored        = (float)objects[9];
            cc.getUnlockEquippedWithType <Pistol> ().setMode((byte)objects [10]);
            if (team == 0)
            {
                cc.getUnlockEquippedWithType <Throwable> ().coolDownStartedAt = (float)objects [11];
            }
            else if (Player.thisPlayer)
            {
                Player.thisPlayer.trapCoolDownsStartedAt [0] = (float)objects [11];
                Player.thisPlayer.trapCoolDownsStartedAt [1] = (float)objects [12];
            }
        }
        else if (classNum == 2)
        {
            cc.getUnlockEquippedWithType <PlaceEarthMound> ().coolDownStartedAt = (float)objects[8];
            if (team == 0)
            {
                cc.getUnlockEquippedWithType <PlaceMirror> ().coolDownStartedAt = (float)objects [9];
            }
            else if (Player.thisPlayer)
            {
                Player.thisPlayer.trapCoolDownsStartedAt [0] = (float)objects [9];
                Player.thisPlayer.trapCoolDownsStartedAt [1] = (float)objects [10];
            }
        }
        else if (classNum == 3)
        {
            sp.GetComponent <PlayerMove> ().movementAbilityCoolDownStartedAt      = (float)objects[8];
            cc.getUnlockEquippedWithType <ThrowableFootball> ().coolDownStartedAt = (float)objects[9];
            if (team == 0)
            {
                cc.getUnlockEquippedWithType <GolfSwing> ().coolDownStartedAt = (float)objects [10];
            }
            else if (Player.thisPlayer)
            {
                Player.thisPlayer.trapCoolDownsStartedAt [0] = (float)objects [10];
                Player.thisPlayer.trapCoolDownsStartedAt [1] = (float)objects [11];
            }
        }
        else if (classNum == 4)
        {
            cc.GetComponent <PlayerMove> ().movementAbilityCoolDownStartedAt = (float)objects [8];
            if (team == 0)
            {
            }
            else if (Player.thisPlayer)
            {
                Player.thisPlayer.trapCoolDownsStartedAt [0] = (float)objects [9];
                Player.thisPlayer.trapCoolDownsStartedAt [1] = (float)objects [10];
            }
        }
    }