コード例 #1
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>();
 }
コード例 #2
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);
    }