コード例 #1
0
    void Start()
    {
        if (onFireEvent == null)
            onFireEvent = zzUtilities.nullFunction;

        if (offFireEvent == null)
            offFireEvent = zzUtilities.nullFunction;

        if (!actionCommandControl)
            actionCommandControl = GetComponent<ActionCommandControl>();
    }
コード例 #2
0
 //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>();
 }
コード例 #3
0
    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>();
    }
コード例 #4
0
    //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);
    }
コード例 #5
0
    //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);
        }
    }
コード例 #6
0
    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();
        }
    }