Beispiel #1
0
    void Awake()
    {
        Transform = transform;

        if (null != FlagBaseSingleMesh)
        {
            FlagBaseMaterial = FlagBaseSingleMesh.material;
        }

        if (uLink.Network.isServer)
        {
            BadSpawnPoints  = gameObject.GetComponentsInChildren <SpawnPointBadGuys>(true);
            GoodSpawnPoints = gameObject.GetComponentsInChildren <SpawnPointGoodGuys>(true);

            Temp.Add(E_Team.Bad, 0);
            Temp.Add(E_Team.Good, 0);
        }

        NetworkView = networkView;

        NetworkView.stateSynchronization = uLink.NetworkStateSynchronization.Reliable;
        NetworkView.observed             = this;

        Center = transform.position;

        BaseHeight = (null != Flag) ? Flag.localPosition.z : 1.0f;
        Reset();
    }
Beispiel #2
0
    // Token: 0x06002115 RID: 8469 RVA: 0x0007A0B4 File Offset: 0x000782B4
    public static global::NetEntityID.Kind Of(GameObject entity, out global::NetEntityID entID, out MonoBehaviour view)
    {
        if (!entity)
        {
            entID = global::NetEntityID.unassigned;
            view  = null;
            return(global::NetEntityID.Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component)
        {
            entID = new global::NetEntityID(component.viewID);
            view  = component;
            return(global::NetEntityID.Kind.Net);
        }
        global::NGCView component2 = entity.GetComponent <global::NGCView>();

        if (component2)
        {
            entID = new global::NetEntityID(component2);
            view  = component2;
            return(global::NetEntityID.Kind.NGC);
        }
        entID = global::NetEntityID.unassigned;
        view  = null;
        return(global::NetEntityID.Kind.Missing);
    }
    protected void MineDetected(NetworkViewID mineID, uLink.NetworkMessageInfo info)
    {
        uLink.NetworkView view = uLink.NetworkView.Find(mineID);
        if (view == null)
        {
            return;
        }

        Mine mine = view.GetComponent <Mine>();

        if (mine == null)
        {
            return;
        }

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportMineDetected(Owner.NetworkView.owner, mine, info);
        }
#endif

        if (!mine.IsDetected)
        {
            mine.SetDetected(true);
        }

//		Debug.Log ("MineDetected(), Owner=" + Owner.name + ", mine=" + mine.name);
    }
Beispiel #4
0
    public void CreatePool()
    {
        if (prefab._manualViewID != 0)
        {
            Debug.LogError("Prefab viewID must be set to Allocated or Unassigned", prefab);
            return;
        }

        parent = new GameObject(name + "-Pool").transform;

        for (int i = 0; i < minSize; i++)
        {
            uLink.NetworkView instance = (uLink.NetworkView)Instantiate(prefab);

#if UNITY_4_0
            instance.gameObject.SetActive(false);
#else
            instance.gameObject.SetActiveRecursively(false);
#endif

            instance.transform.parent = parent;

            pool.Push(instance);
        }

        uLink.NetworkInstantiator.Add(prefab.name, Creator, Destroyer);
    }
Beispiel #5
0
    public static Kind Of(GameObject entity, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
    {
        if (entity == null)
        {
            entID = unassigned;
            view  = null;
            return(Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component != null)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(Kind.Net);
        }
        NGCView view3 = entity.GetComponent <NGCView>();

        if (view3 != null)
        {
            entID = new NetEntityID(view3);
            view  = view3;
            return(Kind.NGC);
        }
        entID = unassigned;
        view  = null;
        return(Kind.Missing);
    }
Beispiel #6
0
    public void Local_HealthChange(float amount, uLink.NetworkViewID attackerID, uLink.NetworkMessageInfo info)
    {
        GameObject gameObject;

        object[] objArray;
        bool     flag;

        if (attackerID != uLink.NetworkViewID.unassigned)
        {
            uLink.NetworkView networkView  = uLink.NetworkView.Find(attackerID);
            uLink.NetworkView networkView1 = networkView;
            if (!networkView)
            {
                gameObject = null;
                objArray   = new object[] { amount, gameObject };
                flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
                return;
            }
            gameObject = networkView1.gameObject;
            objArray   = new object[] { amount, gameObject };
            flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
            return;
        }
        gameObject = null;
        objArray   = new object[] { amount, gameObject };
        flag       = InterpTimedEvent.Queue(this, "DMG", ref info, objArray);
    }
    private void Awake()
    {
        _netView     = GetComponent <uLink.NetworkView>();
        _actionEvent = new Dictionary <EPacketType, Action <uLink.BitStream, uLink.NetworkMessageInfo> >();

        OnPEAwake();
    }
Beispiel #8
0
    public NetworkInstantiatePool(GameObject prefab, int size, ActivateDelegate activate, PrefabInitDelegate prefabInitDelegate)
    {
        Prefab = prefab.GetComponent <uLink.NetworkView>();

        if (null != prefabInitDelegate)
        {
            prefabInitDelegate(prefab);
        }

        MaxSize = size;

        if (Prefab._manualViewID != 0)
        {
            Debug.LogError("Prefab viewID must be set to Allocated or Unassigned", Prefab);
            return;
        }

        Parent = new GameObject("_" + Prefab.name + "-Pool").transform;

        GameObject.DontDestroyOnLoad(Parent);

        for (int i = 0; i < size; i++)
        {
            uLink.NetworkView instance = (uLink.NetworkView)Object.Instantiate(Prefab);
            instance.transform.parent = Parent;
            instance.gameObject.SetActive(false);
            GameObject.DontDestroyOnLoad(instance.gameObject);

            Pool.Push(instance);
        }

        Activate = activate;

        uLink.NetworkInstantiator.Add(Prefab.name, Creator, Destroyer);
    }
Beispiel #9
0
    public void CreatePool()
    {
        if (prefab._manualViewID != 0)
        {
            Debug.LogError("Prefab viewID must be set to Allocated or Unassigned", prefab);
            return;
        }

        // we need to make sure the NetworkView knows the root gameobject in the prefab, of which it belongs to.
        prefab.prefabRoot = prefab.transform.root.gameObject;

        parent = new GameObject(name + "-Pool").transform;

        for (int i = 0; i < minSize; i++)
        {
            uLink.NetworkView instance = (uLink.NetworkView)Instantiate(prefab); // will trigger callback message "Awake" and "OnEnable" (networkView.viewID == unassigned).

            SetActive(instance, false);                                          // will trigger callback message "OnDisable" (networkView.viewID == unassigned).

            instance.transform.parent = parent;

            pool.Push(instance);
        }

        uLink.NetworkInstantiator.Add(prefab.name, Creator, Destroyer);
    }
Beispiel #10
0
    /*
     * private uLink.NetworkView PreInstantiator(string prefabName, Vector3 position, Quaternion rotation, uLink.BitStream stream)
     * {
     *      if (Pool.Count > 0)
     *      {
     *              uLink.NetworkView instance = Pool.Pop();
     *              instance.transform.position = position;
     *              instance.transform.rotation = rotation;
     *              //instance.gameObject.SetActive(true);
     *
     *  //Debug.Log("PreInstantiator " + instance.name);
     *
     *              return instance;
     *      }
     *      else
     *      {
     *              uLink.NetworkView instance = (uLink.NetworkView)Object.Instantiate(Prefab);
     *              instance.transform.parent = Parent;
     *              instance.transform.position = position;
     *              instance.transform.rotation = rotation;
     *
     *  //Debug.Log("PreInstantiator " + instance.name);
     *
     *              return instance;
     *      }
     * }
     *
     * private void PostInstantiator(uLink.NetworkView instance, uLink.NetworkMessageInfo info)
     * {
     *      instance.BroadcastMessage("uLink_OnNetworkInstantiate", info, SendMessageOptions.DontRequireReceiver);
     *
     *      if(Activate != null)
     *              Activate(instance.gameObject);
     *
     * Active.Add(instance);
     * }
     */

    uLink.NetworkView Creator(string prefabName, uLink.NetworkInstantiateArgs args, uLink.NetworkMessageInfo info)
    {
        uLink.NetworkView instance = null;

        if (Pool.Count > 0)
        {
            instance = Pool.Pop();
            args.SetupNetworkView(instance);

            //Debug.Log("Creator " + instance.name);
        }
        else
        {
            instance = uLink.NetworkInstantiatorUtility.Instantiate(Prefab, args);

            //Debug.Log("Creator " + instance.name);
        }

        uLink.NetworkInstantiatorUtility.BroadcastOnNetworkInstantiate(instance, info);

        if (Activate != null)
        {
            Activate(instance.gameObject);
        }

        Active.Add(instance);

        return(instance);
    }
    protected void AgentDetected(NetworkViewID senderID, NetworkViewID agentID, bool detected, uLink.NetworkMessageInfo info)
    {
        uLink.NetworkView agentView = uLink.NetworkView.Find(agentID);
        if (!agentView)
        {
            return;
        }

        uLink.NetworkView senderView = uLink.NetworkView.Find(senderID);
        if (!senderView)
        {
            return;
        }

        AgentHuman agent  = agentView.GetComponent <AgentHuman>();
        AgentHuman sender = senderView.GetComponent <AgentHuman>();

#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportAgentDetected(Owner.NetworkView.owner, agent, sender, info);
        }
#endif

        if (sender && sender.IsAlive && agent && agent.IsAlive && sender.IsFriend(agent) == false)
        {
            agent.BlackBoard.IsDetected = detected;

//			Debug.Log ("AgentDetected(), detected=" + detected + ", Owner=" + Owner.name + ", sender=" + sender.name + ", agent=" + agent.name);
        }
    }
Beispiel #12
0
    public static NetEntityID.Kind Of(GameObject entity, out NetEntityID entID, out UnityEngine.MonoBehaviour view)
    {
        if (!entity)
        {
            entID = NetEntityID.unassigned;
            view  = null;
            return(NetEntityID.Kind.Missing);
        }
        uLink.NetworkView component = entity.GetComponent <uLink.NetworkView>();
        if (component)
        {
            entID = new NetEntityID(component.viewID);
            view  = component;
            return(NetEntityID.Kind.Net);
        }
        NGCView nGCView = entity.GetComponent <NGCView>();

        if (nGCView)
        {
            entID = new NetEntityID(nGCView);
            view  = nGCView;
            return(NetEntityID.Kind.NGC | NetEntityID.Kind.Net);
        }
        entID = NetEntityID.unassigned;
        view  = null;
        return(NetEntityID.Kind.Missing);
    }
Beispiel #13
0
 // Token: 0x060020EF RID: 8431 RVA: 0x00079A50 File Offset: 0x00077C50
 public NetEntityID(uLink.NetworkView view)
 {
     this = default(global::NetEntityID);
     if (view)
     {
         this._viewID = view.viewID;
     }
 }
Beispiel #14
0
    private static void SetActive(uLink.NetworkView instance, bool value)
    {
#if UNITY_3_5 || UNITY_3_4 || UNITY_3_3 || UNITY_3_2 || UNITY_3_1 || UNITY_3_0 || UNITY_2_6
        instance.prefabRoot.SetActiveRecursively(value); // Unity 3.x or older
#else
        instance.prefabRoot.SetActive(value);            // Unity 4.x or later
#endif
    }
Beispiel #15
0
    private void Destroyer(uLink.NetworkView instance)
    {
        SetActive(instance, false);         // will trigger callback message "OnDisable" (networkView.viewID != unassigned).

        instance.transform.parent = parent;

        pool.Push(instance);
    }
Beispiel #16
0
 public NetEntityID(uLink.NetworkView view)
 {
     this = new NetEntityID();
     if (view)
     {
         this._viewID = view.viewID;
     }
 }
    protected void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        mainNetworkView = info.networkView;

        // override the instance's NetworkInsantiator Destroyer delegate.
        oldDestroyer = mainNetworkView.instantiator.destroyer;
        mainNetworkView.instantiator.destroyer = OverrideDestroyer;
    }
Beispiel #18
0
    protected void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        mainNetworkView = info.networkView;

        // override the instance's NetworkInsantiator Destroyer delegate.
        oldDestroyer = mainNetworkView.instantiator.destroyer;
        mainNetworkView.instantiator.destroyer = OverrideDestroyer;
    }
Beispiel #19
0
    private void Destroyer(uLink.NetworkView instance)
    {
#if UNITY_4_0
        instance.gameObject.SetActive(false);
#else
        instance.gameObject.SetActiveRecursively(false);
#endif

        pool.Push(instance);
    }
    protected void Melee(E_MeleeType meleeType, uLink.NetworkViewID viewID, uLink.NetworkMessageInfo info)
    {
        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

        uLink.NetworkView view = uLink.NetworkView.Find(viewID);

        if (null == view)
        {
            // target was just destroyed
            return;
        }

        Agent targetAgent = view.GetComponent <Agent>();

        if (targetAgent == null)
        {
            return;             // wtf ?
        }
#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            if (!ServerAnticheat.ReportAndValidateMelee(Owner.NetworkView.owner, Owner, targetAgent, info))
            {
                // Ignore the action when it is not valid. This may happen even in a regular/fair game when
                // an attacking playerexperiences a lag.
                return;
            }
        }
#endif

        AgentActionMelee a = AgentActionFactory.Create(AgentActionFactory.E_Type.Melee) as AgentActionMelee;
        a.Target    = targetAgent;
        a.MeleeType = meleeType;
        Owner.BlackBoard.ActionAdd(a);

        if (a.IsFailed())
        {
            return;             // wtf ?
        }
        if (Owner.IsServer)
        {
            //send to proxies
            Owner.NetworkView.RPC("Melee", uLink.RPCMode.OthersExceptOwner, meleeType, viewID);

            //knockdown target immediatly, its player, we dont have time wait ....
            Vector3 direction = (a.Target.Position - Owner.Position).normalized;
            a.Target.KnockDown(Owner, meleeType, direction);
        }

        //Debug.Log(Time.timeSinceLevelLoad + " " + "Melee " + a.MeleeType + " " + a.Target.name);
    }
Beispiel #21
0
 protected void Client_OnKilledBy(uLink.NetworkViewID attackerViewID, uLink.NetworkMessageInfo info)
 {
     uLink.NetworkView networkView = uLink.NetworkView.Find(attackerViewID);
     if (networkView)
     {
         Character component = networkView.GetComponent <Character>();
         this.Client_OnKilledShared(component, component, ref info);
     }
     else
     {
         this.Client_OnKilledShared(false, null, ref info);
     }
 }
Beispiel #22
0
 private void OverrideDestroyer(uLink.NetworkView instance)
 {
     if (autoDestroyAfterMessage)
     {
         instance.BroadcastMessage(broadcastMessage, SendMessageOptions.DontRequireReceiver);
         Destroy();
     }
     else
     {
         // if we're relying on the message receiver for cleanup, then make sure there is one.
         instance.BroadcastMessage(broadcastMessage, SendMessageOptions.RequireReceiver);
     }
 }
Beispiel #23
0
    private void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        ushort num;
        ushort num2;

        uLink.NetworkView networkView = info.networkView;
        this.groupID = (int)info.networkView.group;
        this.center  = CullGrid.Flat(networkView.position);
        this.size    = networkView.position.y;
        this.extent  = this.size / 2f;
        CullGrid.CellFromGroupID(this.groupID, out num, out num2);
        base.name = string.Format("GRID-CELL:{0:00000}-[{1},{2}]", this.groupID, num, num2);
        this.y_mc = HeightCast(this.center);
        this.y_xy = HeightCast(new Vector2(this.center.x - this.extent, this.center.y - this.extent));
        this.y_XY = HeightCast(new Vector2(this.center.x + this.extent, this.center.y + this.extent));
        this.y_Xy = HeightCast(new Vector2(this.center.x + this.extent, this.center.y - this.extent));
        this.y_xY = HeightCast(new Vector2(this.center.x - this.extent, this.center.y + this.extent));
        this.y_xc = HeightCast(new Vector2(this.center.x - this.extent, this.center.y));
        this.y_Xc = HeightCast(new Vector2(this.center.x + this.extent, this.center.y));
        this.y_my = HeightCast(new Vector2(this.center.x, this.center.y - this.extent));
        this.y_mY = HeightCast(new Vector2(this.center.x, this.center.y + this.extent));
        base.transform.position = new Vector3(this.center.x, this.y_mc, this.center.y);
        float[] values = new float[] { this.y_xy, this.y_XY, this.y_Xy, this.y_xY, this.y_xc, this.y_Xc, this.y_my, this.y_mY, this.y_mc };
        float   num3   = Mathf.Min(values);

        float[] singleArray2 = new float[] { this.y_xy, this.y_XY, this.y_Xy, this.y_xY, this.y_xc, this.y_Xc, this.y_my, this.y_mY, this.y_mc };
        float   y            = Mathf.Max(singleArray2) - num3;

        this.bounds = new Bounds(new Vector3(this.center.x, num3 + (y * 0.5f), this.center.y), new Vector3(this.size, y, this.size));
        Transform transform = base.transform;

        this.t_xy          = transform.FindChild("BL");
        this.t_XY          = transform.FindChild("FR");
        this.t_Xy          = transform.FindChild("BR");
        this.t_xY          = transform.FindChild("FL");
        this.t_xc          = transform.FindChild("ML");
        this.t_Xc          = transform.FindChild("MR");
        this.t_my          = transform.FindChild("BC");
        this.t_mY          = transform.FindChild("FC");
        this.t_mc          = transform.FindChild("MC");
        this.t_xy.position = new Vector3(this.center.x - this.extent, this.y_xy, this.center.y - this.extent);
        this.t_XY.position = new Vector3(this.center.x + this.extent, this.y_XY, this.center.y + this.extent);
        this.t_Xy.position = new Vector3(this.center.x + this.extent, this.y_Xy, this.center.y - this.extent);
        this.t_xY.position = new Vector3(this.center.x - this.extent, this.y_xY, this.center.y + this.extent);
        this.t_xc.position = new Vector3(this.center.x - this.extent, this.y_xc, this.center.y);
        this.t_Xc.position = new Vector3(this.center.x + this.extent, this.y_Xc, this.center.y);
        this.t_my.position = new Vector3(this.center.x, this.y_my, this.center.y - this.extent);
        this.t_mY.position = new Vector3(this.center.x, this.y_mY, this.center.y + this.extent);
        this.t_mc.position = new Vector3(this.center.x, this.y_mc, this.center.y);
        transform.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().localBounds = new Bounds(new Vector3(0f, this.y_mc - (num3 + (y * 0.5f)), 0f), new Vector3(this.size, y, this.size));
    }
        private static uLink.NetworkView FindByManualViewID(int manualID, uLink.NetworkView exclude)
        {
            var all = Resources.FindObjectsOfTypeAll(typeof(uLink.NetworkView)) as uLink.NetworkView[];

            foreach (var nv in all)
            {
                if (nv != exclude && nv._manualViewID == manualID && EditorUtility.GetPrefabType(nv) != PrefabType.Prefab)
                {
                    return(nv);
                }
            }

            return(null);
        }
Beispiel #25
0
    private void uLink_OnNetworkInstantiate(uLink.NetworkMessageInfo info)
    {
        ushort num;
        ushort num1;

        uLink.NetworkView networkView = info.networkView;
        this.groupID = info.networkView.@group;
        this.center  = CullGrid.Flat(networkView.position);
        this.size    = networkView.position.y;
        this.extent  = this.size / 2f;
        CullGrid.CellFromGroupID(this.groupID, out num, out num1);
        base.name = string.Format("GRID-CELL:{0:00000}-[{1},{2}]", this.groupID, num, num1);
        this.y_mc = CullCell.HeightCast(this.center);
        this.y_xy = CullCell.HeightCast(new Vector2(this.center.x - this.extent, this.center.y - this.extent));
        this.y_XY = CullCell.HeightCast(new Vector2(this.center.x + this.extent, this.center.y + this.extent));
        this.y_Xy = CullCell.HeightCast(new Vector2(this.center.x + this.extent, this.center.y - this.extent));
        this.y_xY = CullCell.HeightCast(new Vector2(this.center.x - this.extent, this.center.y + this.extent));
        this.y_xc = CullCell.HeightCast(new Vector2(this.center.x - this.extent, this.center.y));
        this.y_Xc = CullCell.HeightCast(new Vector2(this.center.x + this.extent, this.center.y));
        this.y_my = CullCell.HeightCast(new Vector2(this.center.x, this.center.y - this.extent));
        this.y_mY = CullCell.HeightCast(new Vector2(this.center.x, this.center.y + this.extent));
        base.transform.position = new Vector3(this.center.x, this.y_mc, this.center.y);
        float single  = Mathf.Min(new float[] { this.y_xy, this.y_XY, this.y_Xy, this.y_xY, this.y_xc, this.y_Xc, this.y_my, this.y_mY, this.y_mc });
        float single1 = Mathf.Max(new float[] { this.y_xy, this.y_XY, this.y_Xy, this.y_xY, this.y_xc, this.y_Xc, this.y_my, this.y_mY, this.y_mc }) - single;

        this.bounds = new Bounds(new Vector3(this.center.x, single + single1 * 0.5f, this.center.y), new Vector3(this.size, single1, this.size));
        Transform bound = base.transform;

        this.t_xy          = bound.FindChild("BL");
        this.t_XY          = bound.FindChild("FR");
        this.t_Xy          = bound.FindChild("BR");
        this.t_xY          = bound.FindChild("FL");
        this.t_xc          = bound.FindChild("ML");
        this.t_Xc          = bound.FindChild("MR");
        this.t_my          = bound.FindChild("BC");
        this.t_mY          = bound.FindChild("FC");
        this.t_mc          = bound.FindChild("MC");
        this.t_xy.position = new Vector3(this.center.x - this.extent, this.y_xy, this.center.y - this.extent);
        this.t_XY.position = new Vector3(this.center.x + this.extent, this.y_XY, this.center.y + this.extent);
        this.t_Xy.position = new Vector3(this.center.x + this.extent, this.y_Xy, this.center.y - this.extent);
        this.t_xY.position = new Vector3(this.center.x - this.extent, this.y_xY, this.center.y + this.extent);
        this.t_xc.position = new Vector3(this.center.x - this.extent, this.y_xc, this.center.y);
        this.t_Xc.position = new Vector3(this.center.x + this.extent, this.y_Xc, this.center.y);
        this.t_my.position = new Vector3(this.center.x, this.y_my, this.center.y - this.extent);
        this.t_mY.position = new Vector3(this.center.x, this.y_mY, this.center.y + this.extent);
        this.t_mc.position = new Vector3(this.center.x, this.y_mc, this.center.y);
        bound.gameObject.GetComponentInChildren <SkinnedMeshRenderer>().localBounds = new Bounds(new Vector3(0f, this.y_mc - (single + single1 * 0.5f), 0f), new Vector3(this.size, single1, this.size));
    }
Beispiel #26
0
    void Destroyer(uLink.NetworkView instance)
    {
        // Debug.Log(Time.timeSinceLevelLoad + "Destroyer " + instance.name);

        instance.SendMessage("Deactivate", SendMessageOptions.DontRequireReceiver);

        instance.gameObject.SetActive(false);

        Active.Remove(instance);

        if (MaxSize == Pool.Count)
        {
            Object.Destroy(instance.gameObject);
            return;
        }
        Pool.Push(instance);
    }
Beispiel #27
0
    private void Destroyer(uLink.NetworkView instance)
    {
        Profiler.BeginSample("Destroy: " + networkView.ToPrefabString());

        if (autoDestroyAfterMessage)
        {
            instance.BroadcastMessage(broadcastMessage, SendMessageOptions.DontRequireReceiver);
            Destroy(networkView.gameObject);
        }
        else
        {
            // if we're relying on the message receiver for cleanup, then make sure there is one.
            instance.BroadcastMessage(broadcastMessage, SendMessageOptions.RequireReceiver);
        }

        Profiler.EndSample();
    }
Beispiel #28
0
 private uLink.NetworkView PreInstantiator(string prefabName, Vector3 position, Quaternion rotation)
 {
     if (pool.Count > 0)
     {
         uLink.NetworkView instance = pool.Pop();
         instance.transform.position = position;
         instance.transform.rotation = rotation;
         instance.gameObject.SetActiveRecursively(true);
         return(instance);
     }
     else
     {
         uLink.NetworkView instance = (uLink.NetworkView)Instantiate(prefab);
         instance.transform.parent   = parent;
         instance.transform.position = position;
         instance.transform.rotation = rotation;
         return(instance);
     }
 }
Beispiel #29
0
    protected void _Destroyer(uLink.NetworkView networkView)
    {
        NetInstance instance = _currentNetInstance;

        try
        {
            NetInstance component = networkView.GetComponent <NetInstance>();
            _currentNetInstance = component;
            if (component != null)
            {
                component.zzz___onpredestroy();
            }
            UnityEngine.Object.Destroy(networkView.gameObject);
        }
        finally
        {
            _currentNetInstance = instance;
        }
    }
    protected void Death(NetworkViewID attackerNVId, Vector3 pos, Vector3 impuls, short damage, short bodyPart)
    {
#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportPotentialCheatAttempt("Death", "should never be called on the server side", Owner.NetworkView.owner);
            return;
        }
#endif

        if (Owner.BlackBoard.DontUpdate)
        {
            return;
        }

        uLink.NetworkView View = (attackerNVId != uLink.NetworkViewID.unassigned) ? uLink.NetworkView.Find(attackerNVId) : null;

        Owner.Die(View ? View.GetComponent <AgentHuman>() : null, pos, impuls, damage, (E_BodyPart)bodyPart);
    }
Beispiel #31
0
    protected void _Destroyer(uLink.NetworkView networkView)
    {
        NetInstance netInstance = NetMainPrefab._currentNetInstance;

        try
        {
            NetInstance component = networkView.GetComponent <NetInstance>();
            NetMainPrefab._currentNetInstance = component;
            if (component)
            {
                component.zzz___onpredestroy();
            }
            UnityEngine.Object.Destroy(networkView.gameObject);
        }
        finally
        {
            NetMainPrefab._currentNetInstance = netInstance;
        }
    }
 private CustomInstantiationArgs(NetMainPrefab netMain, UnityEngine.Object customInstantiator, IDMain prefab, ref NetworkInstantiateArgs args, bool server, bool checkCustomInstantitorArgument)
 {
     this.netMain = netMain;
     this.prefab = prefab;
     this.prefabNetworkView = prefab.networkView;
     this.args = args;
     this.server = server;
     if (!checkCustomInstantitorArgument || !customInstantiator)
     {
         this.hasCustomInstantiator = CustomInstantiationArgs.CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate);
     }
     else
     {
         this.customInstantiate = customInstantiator as IPrefabCustomInstantiate;
         if (this.customInstantiate != null)
         {
             this.hasCustomInstantiator = true;
         }
         else
         {
             this.hasCustomInstantiator = CustomInstantiationArgs.CheckNetworkViewCustomInstantiator(this.prefabNetworkView, this.prefab, out this.customInstantiate);
         }
     }
 }
Beispiel #33
0
 internal void PrepareInstantiate(Facepunch.NetworkView view, ref uLink.NetworkMessageInfo info)
 {
     PlayerClient playerClient;
     this.__controllerCreateMessageInfo = info;
     this.__networkViewForControllable = view;
     if (this.classFlagsRootControllable || this.classFlagsStandaloneVessel)
     {
         this.__controllerDriverViewID = uLink.NetworkViewID.unassigned;
         if (this.classFlagsStandaloneVessel)
         {
             return;
         }
     }
     else if (this.classFlagsDependantVessel || this.classFlagsFreeVessel)
     {
         if (!PlayerClient.Find(view.owner, out playerClient))
         {
             this.__controllerDriverViewID = uLink.NetworkViewID.unassigned;
         }
         else
         {
             this.__controllerDriverViewID = playerClient.topControllable.networkViewID;
         }
         if (this.classFlagsFreeVessel)
         {
             return;
         }
         if (this.__controllerDriverViewID == uLink.NetworkViewID.unassigned)
         {
             UnityEngine.Debug.LogError("NOT RIGHT");
             return;
         }
     }
     this.FreshInitializeController();
 }
Beispiel #34
0
 private void OCO_FOUND(uLink.NetworkViewID viewID, ref uLink.NetworkMessageInfo info)
 {
     this.SetIdle(false);
     this.__networkViewForControllable = base.networkView;
     this.__controllerDriverViewID = viewID;
     this.__controllerCreateMessageInfo = info;
     this.FreshInitializeController();
 }