Exemplo n.º 1
0
    public void Aim(Vector3 y, Vector3 agentPos, bool lastAim = false)
    {
        if (isDead || y == transform.position)
        {
            return;
        }

        if (skillStart >= Time.time || !lastAimReceived)
        {
            y.y = 0;

            transform.rotation = Quaternion.LookRotation(y - agentPos);
            aimPoint           = y;

            MObjects.AgentAim mObject = new MObjects.AgentAim();
            mObject.y  = y;
            mObject.id = (user != null) ? user.connectionId: customId;

            int _c = session.users.Count;
            for (int i = 0; i < _c; i++)
            {
                if (NetworkServer.connections.Contains(session.users[i]))
                {
                    // send the mobject
                    NetworkServer.SendToClient(session.users[i].connectionId, MTypes.AgentAim, mObject);
                }
            }
        }

        lastAimReceived = lastAim;
    }
Exemplo n.º 2
0
    public void OnAgentAim(NetworkMessage netMsg)
    {
        MObjects.AgentAim mObject = netMsg.ReadMessage <MObjects.AgentAim>();

        MobileAgent ma = MobileAgent.list.Find(x => x.id == mObject.id);

        if (ma == null)
        {
            return;
        }

        if (!ma.isController)
        {
            ma.aimPoint = mObject.y;
        }
    }