// Use this for initialization void Awake() { InitNpcAmmoList(); CountHuanDan = Random.Range(3, 8); AnimatorCom = GetComponent <Animator>(); NpcRunAniCtrl = AnimatorCom.runtimeAnimatorController; NpcScript = GetComponentInParent <XKNpcMoveCtrl>(); SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); }
void Start() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); NetworkViewCom = GetComponent <NetworkView>(); if (transform.parent != XkGameCtrl.MissionCleanup) { transform.parent = XkGameCtrl.MissionCleanup; } }
// Use this for initialization void Start() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); for (int i = 0; i < QianGuanTwRot.Length; i++) { QianGuanTwRot[i].enabled = false; } FireLayer = XkGameCtrl.GetInstance().PlayerAmmoHitLayer; PlayerScript = GetComponent <XkPlayerCtrl>(); PlayerScript.SetPlayerAutoFireScript(this); PlayerStEnum = PlayerScript.PlayerSt; AmmoStatePOne = PlayerAmmoType.PuTongAmmo; AmmoStatePTwo = PlayerAmmoType.PuTongAmmo; if (PlayerStEnum != PlayerTypeEnum.CartoonCamera) { PlayerAudio = PlayerScript.PlayerAudio; for (int i = 0; i < 7; i++) { if (i < 6) { PlayerAudio[i].loop = false; } else { PlayerAudio[i].loop = true; } PlayerAudio[i].Stop(); } InitPlayerAmmoList(); //InputEventCtrl.GetInstance().ClickFireBtOneEvent += ClickFireBtOneEvent; InputEventCtrl.GetInstance().ClickFireBtTwoEvent += ClickFireBtTwoEvent; //InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent += ClickDaoDanBtOneEvent; InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent += ClickDaoDanBtTwoEvent; // if (Network.peerType == NetworkPeerType.Server) { // InitPlayerAmmoList(); // } // // if ((PlayerStEnum == PlayerTypeEnum.FeiJi && XkGameCtrl.GameJiTaiSt == GameJiTaiType.FeiJiJiTai) // || (PlayerStEnum == PlayerTypeEnum.TanKe && XkGameCtrl.GameJiTaiSt == GameJiTaiType.TanKeJiTai)){ // InitPlayerAmmoList(); // InputEventCtrl.GetInstance().ClickFireBtOneEvent += ClickFireBtOneEvent; // InputEventCtrl.GetInstance().ClickFireBtTwoEvent += ClickFireBtTwoEvent; // InputEventCtrl.GetInstance().ClickDaoDanBtOneEvent += ClickDaoDanBtOneEvent; // InputEventCtrl.GetInstance().ClickDaoDanBtTwoEvent += ClickDaoDanBtTwoEvent; // } } else { this.enabled = false; } }
void Awake() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); if (TrailScript == null) { TrailScript = GetComponentInChildren <TrailRenderer>(); if (TrailScript != null) { TrailScript.shadowCastingMode = UnityEngine.Rendering.ShadowCastingMode.Off; TrailScript.receiveShadows = false; TrailTime = TrailScript.time; } } AmmoTran = transform; ObjAmmo = gameObject; AmmoTran.parent = XkGameCtrl.PlayerAmmoArray; }
// Use this for initialization void Start() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); if (DeathExplodePoint == null) { DeathExplodePoint = transform; } if (AudioCannonFire != null) { AudioCannonFire.Stop(); } if (SpawnAmmoPoint.Length <= 0) { Debug.LogWarning("XKCannonCtrl -> SpawnAmmoPoint was wrong!"); IsOutputError = true; } else { for (int i = 0; i < SpawnAmmoPoint.Length; i++) { if (SpawnAmmoPoint[i] == null) { Debug.LogWarning("XKCannonCtrl -> SpawnAmmoPoint was wrong! index = " + i); IsOutputError = true; break; } } } if (DaPaoHiddenArray.Length > 0) { int max = DaPaoHiddenArray.Length; for (int i = 0; i < max; i++) { if (DaPaoHiddenArray[i] == null) { Debug.LogWarning("DaPaoHiddenArray was wrong! index is " + i); IsOutputError = true; break; } XKDaPaoCtrl daPaoScript = DaPaoHiddenArray[i].GetComponent <XKDaPaoCtrl>(); if (daPaoScript != null) { Debug.LogWarning("DaPaoHiddenArray was wrong! name is " + daPaoScript.gameObject.name); } } } CosAngleUp = Mathf.Cos((UpPaoGuanJDVal / 180f) * Mathf.PI); CosAngleDown = Mathf.Cos((DownPaoGuanJDVal / 180f) * Mathf.PI); CannonTran = transform; if (HealthScript == null) { HealthScript = GetComponent <XKNpcHealthCtrl>(); } if (HealthScript != null) { HealthScript.SetCannonScript(this); IsYouTongNpc = HealthScript.IsYouTongNpc; } if (SpawnAmmoPoint.Length > 1) { IsDouGuanDaPao = true; } InitNpcAmmoList(); NpcMoveScript = GetComponentInParent <XKNpcMoveCtrl>(); if (NpcMoveScript != null && IsHiddenAmmoSpawnPoint) { NpcMoveScript.SetIsRemoveNpcObj(); } if (IsOutputError) { GameObject obj = null; obj.name = "null"; } }
void Awake() { SpawnParticleCom = gameObject.AddComponent <XKSpawnParticle>(); if (NpcAniController.Length > 0) { for (int i = 0; i < NpcAniController.Length; i++) { if (NpcAniController[i] == null) { Debug.LogWarning("NpcAniController was wrong!"); GameObject obj = null; obj.name = "null"; break; } } int randVal = Random.Range(0, (1 + NpcAniController.Length)); if (randVal < NpcAniController.Length && ZaiTiNpcAni != null) { ZaiTiNpcAni.runtimeAnimatorController = NpcAniController[randVal]; } //ZaiTiNpcAni.runtimeAnimatorController = NpcAniController[0]; //test } if (IsTeShuFireNpc) { if (TimeFireAmmo.Length != AmmoPrefabTeShu.Length || TimeFireAmmo.Length != AmmoSpawnTranTeShu.Length) { Debug.LogWarning("IsTeShuFireNpc was true, but TimeFireAmmo or AmmoPrefabTeShu or AmmoSpawnTranTeShu length was wrong!"); GameObject obj = null; obj.name = "null"; } for (int i = 0; i < TimeFireAmmo.Length; i++) { if (TimeFireAmmo[i] < 0.005f) { TimeFireAmmo[i] = 0.005f; } } InitNpcAmmoList(); } if (ZaiTiNpcBuWaWa != null) { ZaiTiNpcBuWaWa.gameObject.SetActive(false); } NpcObj = gameObject; NpcTran = transform; if (DeathExplodePoint == null) { DeathExplodePoint = NpcTran; } // XKNpcHealthCtrl healthScript = GetComponent<XKNpcHealthCtrl>(); // healthScript.SetNpcJiFen(NpcJiFen); NpcScript = GetComponentInParent <XKNpcMoveCtrl>(); if (NpcScript != null) { if (NpcScript.IsAniMove) { Rigidbody rig = GetComponent <Rigidbody>(); if (rig == null) { gameObject.AddComponent <Rigidbody>(); } Invoke("DelaySetRigidbodyInfo", 0.2f); } } TimeTeShuFire = new float[TimeFireAmmo.Length]; }