void Start() { if (onFireEvent == null) onFireEvent = zzUtilities.nullFunction; if (offFireEvent == null) offFireEvent = zzUtilities.nullFunction; if (!actionCommandControl) actionCommandControl = GetComponent<ActionCommandControl>(); }
//FIXME_VAR_TYPE transform; //void Start() //{ // //GameObject lOwner = transform.parent.gameObject; // if (!owner) // return; // if (Network.peerType != NetworkPeerType.Disconnected && networkView.isMine) // { // networkView.RPC("RPCSetOwner", RPCMode.Others, owner.networkView.viewID); // networkView.enabled = true; // } //} public void setOwner(GameObject pOwner) { gameObject.name = "NS"; transform.parent = pOwner.transform; transform.localPosition = Vector3.zero; owner = pOwner; hero = owner.GetComponentInChildren<Hero>(); character = hero.getCharacter(); actionCommandControl = owner.GetComponentInChildren<ActionCommandControl>(); life = owner.GetComponent<Life>(); soldierModelSmoothMove = owner.GetComponent<SoldierModelSmoothMove>(); }
public void RPCSetOwner(NetworkViewID pOwnerID) { GameObject lOwnerHeroObject = NetworkView.Find(pOwnerID).gameObject; gameObject.name = "NS"; transform.parent = lOwnerHeroObject.transform; owner = lOwnerHeroObject; //------------------------------------------- Hero lHero = owner.GetComponentInChildren<Hero>(); character = lHero.getCharacter(); actionCommandControl = owner.GetComponentInChildren<ActionCommandControl>(); life = owner.GetComponent<Life>(); }
//class NetData //{ // public NetData(int p1, int p2, double pTimestamp) // { // part1 = p1; // part2 = p2; // timestamp = pTimestamp; // } // public int part1; // public int part2; // public double timestamp; //} //System.Collections.Generic.Queue<NetData> netDataQueue // = new System.Collections.Generic.Queue<NetData>(); void Awake() { if (!soldier) soldier = gameObject.GetComponentInChildren<Soldier>(); //if(!soldier) // soldier=gameObject.GetComponentInChildren<Soldier>().getCharacter(); //character = gameObject.GetComponentInChildren<Soldier>().getCharacter(); soldierModelSmoothMove = GetComponent<SoldierModelSmoothMove>(); character = soldier.getCharacter(); actionCommandControl = gameObject.GetComponentInChildren<ActionCommandControl>(); if (!life) life = gameObject.GetComponentInChildren<Life>(); if (Network.isClient) { Destroy(soldier.GetComponentInChildren<SoldierAI>()); //disappearTimer = gameObject.AddComponent<zzTimer>(); //disappearTimer.setInterval(disappearTime); //disappearTimer.addImpFunction(disappear); //life.addDieCallback((x) => disappearTimer.enabled = false); if (!networkDisappear) { networkDisappear = gameObject.AddComponent<NetworkDisappear>(); networkDisappear.life = life; networkDisappear.disenableWhenDisappear = new MonoBehaviour[] { soldier }; networkDisappear.addDisappearEventReceiver(showDisappear); } } //if(disenableWhenDisappear ==null||disenableWhenDisappear.Length==0) //{ // disenableWhenDisappear //} //if( !zzCreatorUtility.isMine(gameObject.networkView ) ) //{ // Destroy(soldier.GetComponentInChildren<SoldierAI>()); //} //if(!soldier) // Debug.LogError(gameObject.name); }
//FIXME_VAR_TYPE transform; void Start() { //GameObject lOwner = transform.parent.gameObject; if (!owner) return; Hero lHero = owner.GetComponentInChildren<Hero>(); character = lHero.getCharacter(); actionCommandControl = owner.GetComponentInChildren<ActionCommandControl>(); life = owner.GetComponent<Life>(); if (Network.peerType != NetworkPeerType.Disconnected && networkView.isMine) { networkView.RPC("RPCSetOwner", RPCMode.Others, owner.networkView.viewID); } }
void Start() { if (!zzCreatorUtility.isHost()) { Destroy(this); return; } //寻路的计时器 pathTimer = gameObject.AddComponent<zzCoroutineTimer>(); pathTimer.setInterval(pathSearchInterval); pathTimer.setImpFunction(this.pathUpdate); //行为更新的计时器 actionCommandTimer = gameObject.AddComponent<zzTimer>(); actionCommandTimer.setInterval(actionCommandUpdateInterval); actionCommandTimer.addImpFunction(this.actionCommandUpdate); //广范围探测追踪(敌人)的计时器 zzCoroutineTimer lFollowDetectorTimer = gameObject.AddComponent<zzCoroutineTimer>(); lFollowDetectorTimer.setInterval(followDetectIterval); lFollowDetectorTimer.setImpFunction(this.detectFollowed); if (!actionCommandControl) actionCommandControl = gameObject.GetComponentInChildren<ActionCommandControl>(); AIStart(); //产生第一个命令 if (enable) { pathUpdate(); actionCommandUpdate(); } }