示例#1
0
    void OnServerAddDamage(int Damage)
    {
        if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
        {
            Damages += Damage;
            Waroftanks.Music.BattleMusic.PlayBGMinFight();

            //BattleLog.text = uGUI_Localsize.GetContent("CausedDamage")+Damages.ToString()+uGUI_Localsize.GetContent("KillTankInAll")+KillTanks.ToString();
            playerState.UpdataGameNote(uGUI_Localsize.GetContent("CausedDamage") + Damage.ToString());
            playerState.UpdateDamageBar(Damages, KillTanks);
            InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Armor_Pierced, InGameVoiceSoundManager.InGameVoiceLanguage(nationType));
        }
    }
示例#2
0
 void OnServerNotBreakDown(int Armor)
 {
     if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
     {
         Debug.Log("OnServerNotBreakDown");
         playerState.UpdataGameNote(uGUI_Localsize.GetContent("NotBreakDown") + uGUI_Localsize.GetContent("HitArmor") + Armor.ToString());
         InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Armor_Not_Pierced, InGameVoiceSoundManager.InGameVoiceLanguage(nationType));
     }
 }
示例#3
0
 void Start()
 {
     Self = this;
 }
示例#4
0
    public IEnumerator Init()
    {
        PTC       = GetComponent <PlayerTracksController> ();
        MaxHealth = Health;
        #region 多人模式
        if (netType == InstanceNetType.GameNetworkClient)
        {
            Mine = true;
        }
        #endregion
        #region 单人模式
        else if (netType == InstanceNetType.GameNetWorkOffline)
        {
            Mine = true;
        }
        #endregion
        Invoke("SwtichToNormalMode", 5);

        //InitAIObstacle ();

        if (netType == InstanceNetType.GameNetworkMaster)
        {
            PTC.SetWheels(true, false, false);
            InitExtraTankFires(false);
            transform.parent.GetComponentInChildren <TankFire> ().InitSystem();
        }
        if (netType == InstanceNetType.GameNetworkOthers)
        {
            PTC.SetWheels(false, false, true);
            InitExtraTankFires(false);
            TankScript.GetComponent <TankFire>().InitSystem();
        }
        yield return(new WaitForEndOfFrame());


        if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
        {
            MainCamera = this.transform.root.GetComponentInChildren <Camera>();
            PTC.SetWheels(true, true, true);

            StartCoroutine(InGameVoiceSoundManager.Self.Init(playerStateParameter.nationType, (InGameVoiceSoundManagerReturnValue) => {
                InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Start_Battle, InGameVoiceSoundManager.InGameVoiceLanguage(playerStateParameter.nationType));
            }));


            #region UI初始化
            StartCoroutine(InitTankUISystem(ReturnValue => {
                TankUISystemInit();
                InitExtraTankFires(true);
                UpdateHealthBar();

                TankScript.GetComponent <TankFire>().isPlayerControl = true;
                TankScript.GetComponent <TankFire>().InitSystem();
                TankScript.GetComponent <TankFire>().OnAmmoOut();
                TankScript.GetComponent <TankFire> ().ReSetAmmoSprits();
            }));
            #endregion

            StartCoroutine(CheckIfPlayerRollOver());
        }
    }
示例#5
0
    void OnDeadActionCalled()
    {
        Debug.Log("OnDeadActionCalled");

        if (netType != InstanceNetType.GameNetworkMaster)
        {
            PTC.enableUserInput = false;
            GetComponent <Rigidbody>().velocity        = Vector3.zero;
            GetComponent <Rigidbody>().angularVelocity = Vector3.zero;

            if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
            {
                PTC.enableUserInput = false;
                PTC.UpdateWheels(0, 0);
                PTC.enabled = false;


                Destroy(TankUIRoot.gameObject);

                //GameNetwork.Instance.OnClientPlayerDead();
                //transform.root.GetComponentInChildren<Camera>().gameObject.AddComponent<Grayscale>().shader = Shader.Find("Hidden/Grayscale Effect");

                InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Vehicle_Destroyed, InGameVoiceSoundManager.InGameVoiceLanguage(playerStateParameter.nationType));

                PoolManager.CreateObject("DestroyEffect", transform.position, transform.eulerAngles);
            }

            if (netType == InstanceNetType.GameNetworkOthers)
            {
                GetComponent <Rigidbody>().isKinematic = true;
            }

            #region 炮塔飞天
            if (Turret.GetComponent <MeshRenderer>() != null)
            {
                if (Turret.GetComponent <Rigidbody>() == null)
                {
                    Turret.AddComponent <Rigidbody>();
                }

                Turret.GetComponent <Rigidbody>().velocity = GetComponent <Rigidbody>().velocity *0.1f;
                Turret.GetComponent <Rigidbody>().AddForceAtPosition(Vector3.up * -500, Turret.transform.position);
                Turret.GetComponent <Rigidbody>().drag       = 0.1f;
                Turret.GetComponent <Rigidbody>().mass       = 1000;
                Turret.GetComponent <Rigidbody>().useGravity = true;
            }
            #endregion
        }
        else
        {
            //GameNetwork.Instance.OnPlayerDead(Util.FindPhotonPlayer (tankInitSystem.PlayerID),tankInitSystem.VehicleName);

            PTC.SwitchRPM = 0;
            PTC.UpdateWheels(0, 0);
            PTC.enabled = false;

            #region 爆炸特效
            PoolManagerSpawnModule.CreateObject("DestroyEffect", transform.position, transform.eulerAngles);
            #endregion
        }

        //foreach(Object temp in DiedDestoryObjects){
        //	if(temp){
        //		foreach (HitBox tempHB in ((GameObject)temp).GetComponentsInChildren<HitBox>()){
        //			if(tempHB){
        //				tempHB.enabled =false;
        //			}
        //		}
        //	}
        //}

        transform.tag = "Untagged";
        if (TankScript.GetComponent <TankFire>().tankFireParameter.HasMachineGun)
        {
            TankScript.GetComponent <TankFire>().GetComponent <MachineGun>().CancelInvoke();
        }
        TankScript.GetComponent <TankFire>().NowTime         = 0;
        TankScript.GetComponent <TankFire>().enabled         = false;
        TankScript.GetComponent <TurretController>().enabled = false;

        Destroy(GetComponent <Identity> ());

        GameEventManager.onPlayerVehicleDestroyed();

        if (GameDataManager.OfflineMode)
        {
            Destroy(transform.root.gameObject, 5f);
        }
    }
示例#6
0
 void OnServerKillTank()
 {
     if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
     {
         Waroftanks.Music.BattleMusic.StopBGM();
         playerState.UpdataGameNote(uGUI_Localsize.GetContent("KillTank"));
         KillTanks++;
         playerState.UpdateDamageBar(Damages, KillTanks);
         InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Enemy_Killed, InGameVoiceSoundManager.InGameVoiceLanguage(nationType));
         //BattleLog.text = uGUI_Localsize.GetContent ("CausedDamage") + Damages.ToString () + uGUI_Localsize.GetContent ("KillTankInAll") + KillTanks.ToString ();
     }
 }
示例#7
0
 void OnServerRicochet()
 {
     if (netType == InstanceNetType.GameNetworkClient || netType == InstanceNetType.GameNetWorkOffline)
     {
         playerState.UpdataGameNote(uGUI_Localsize.GetContent("Ricochet"));
         InGameVoiceSoundManager.PlayVoice(InGameVoiceSoundManager.VoiceType.Armor_Ricochet, InGameVoiceSoundManager.InGameVoiceLanguage(nationType));
     }
 }