Пример #1
0
    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);
    }
Пример #2
0
    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);
        }
    }
Пример #3
0
    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);
    }
Пример #4
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);
     }
 }
Пример #5
0
    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);
    }
Пример #6
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;
        }
    }
Пример #7
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;
        }
    }
Пример #8
0
    // Token: 0x06002176 RID: 8566 RVA: 0x0007B414 File Offset: 0x00079614
    protected void _Destroyer(uLink.NetworkView networkView)
    {
        global::NetInstance currentNetInstance = global::NetMainPrefab._currentNetInstance;

        try
        {
            global::NetInstance component = networkView.GetComponent <global::NetInstance>();
            global::NetMainPrefab._currentNetInstance = component;
            if (component)
            {
                component.zzz___onpredestroy();
            }
            Object.Destroy(networkView.gameObject);
        }
        finally
        {
            global::NetMainPrefab._currentNetInstance = currentNetInstance;
        }
    }
Пример #9
0
    protected void Knockdown(E_MeleeType meleeType, uLink.NetworkViewID viewId, Vector3 direction)
    {
#if !DEADZONE_CLIENT
        if (Owner.IsServer)
        {
            ServerAnticheat.ReportPotentialCheatAttempt("Knockdown", "should never be called on the server side", Owner.NetworkView.owner);
            return;
        }
#endif

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

        uLink.NetworkView View     = (viewId != uLink.NetworkViewID.unassigned) ? uLink.NetworkView.Find(viewId) : null;
        AgentHuman        attacker = View ? View.GetComponent <AgentHuman>() : null;

        Owner.KnockDown(attacker, meleeType, direction);
    }