Ejemplo n.º 1
0
    public static IEnumerator ActivedShield(TankHealth tankHealth, TankEffects tankEffects, float tmpArmor, float timeImmortality)
    {
        tankHealth.SetArmor(9999);
        tankEffects.ShieldState(true);
        yield return(new WaitForSeconds(timeImmortality));

        tankHealth.SetArmor(tmpArmor);
        tankEffects.ShieldState(false);
    }
Ejemplo n.º 2
0
    /// ///////////////////////
    public void OnEvent(EventData photonEvent)
    {
        byte eventCode = photonEvent.Code;

        if (eventCode == (byte)PhotonEventCodes.resume)
        {
            object[] data        = (object[])photonEvent.CustomData;
            object[] listItemObj = (object[])data[0];
            int      length      = (int)listItemObj[0];
            bool[]   listItem    = new bool[length];
            for (int i = 0; i < length; i++)
            {
                listItem[i] = (bool)listItemObj[i + 1];
            }
            ItemManager.m_instance.SetItem(listItem);
            {
                for (int i = 0; i < PLayerNetwork.m_instance.m_numPlayerInGame; i++)
                {
                    PlayerManager pm = GameSetup.m_instance.m_listPlayerTeam[i];
                    if (!pm)
                    {
                        Debug.Log("Player " + i + " null");
                        continue;
                    }
                    Rigidbody  rd      = pm.gameObject.GetComponent <Rigidbody>();
                    TankHealth h       = pm.gameObject.GetComponent <TankHealth>();
                    object[]   content = (object[])data[i + 1];
                    bool       isDead  = (bool)content[0];
                    int        score   = (int)content[1];
                    Vector3    pos     = (Vector3)content[2];
                    h.SetDead(isDead);
                    pm.SetScore(score);
                    rd.position = pos;
                    if (!isDead)
                    {
                        Vector3    velocity       = (Vector3)content[3];
                        Quaternion rotation       = (Quaternion)content[4];
                        Quaternion turretRotation = (Quaternion)content[5];
                        bool       shellUpdate    = (bool)content[6];
                        float      healthUpdate   = (float)content[7];
                        bool       armorUpdate    = (bool)content[8];
                        bool       immortalUpdate = (bool)content[9];
                        rd.velocity          = velocity;
                        rd.rotation          = rotation;
                        pm.m_turret.rotation = turretRotation * Quaternion.Inverse(rotation);
                        pm.SetScore(score);
                        pm.SetShell(shellUpdate);
                        h.SetHealth(healthUpdate);
                        h.SetArmor(armorUpdate);
                        h.SetImmortal(immortalUpdate);
                    }
                }
            }
        }
    }