Ejemplo n.º 1
0
    public void changePlayerInstance(GameObject playerInst)
    {
        var pii = playerInst.GetComponent <PlayerInstanceInfo> ();

        if (pii != null)
        {
            anim           = pii.anim;
            ownRigidBody   = pii.ownRigidBody;
            ownTransform   = pii.ownTransform;
            torsoTransform = pii.torsoTransform;
            bulletSpawn    = pii.bulletSpawn;
            nameText       = pii.nameText;
            ni             = pii.ni;
            healthBar      = pii.healthBar;
            if (pointerPick != null)
            {
                pointerPick.gunTrans = pii.gunTrans;
            }
        }
        spawned = true;
    }
    public IdentityAndTransform(GameObject instanceL, int prefabIndexL, int objID, int authorityID, bool childL)
    {
        instance    = instanceL;
        prefabIndex = prefabIndexL;
        child       = childL;

        netIdentity = instanceL.GetComponent <NetIdentityCustom>();
        if (netIdentity == null)
        {
            netIdentity = instanceL.AddComponent <NetIdentityCustom> ();
        }

        type = netIdentity.type;
        netIdentity.objID       = objID;
        netIdentity.AuthorityID = authorityID;

        netTrans = instanceL.GetComponent <NetTransformCustom>();
        if (netTrans == null)
        {
            netTrans = instanceL.AddComponent <NetTransformCustom> ();
        }
    }