Пример #1
0
    public override void SendToLocalGameObject(FFBasePacket package, GameObject go)
    {
        FFPacket <EventType> sentPackage = (FFPacket <EventType>)package;

        FFPacket <EventType> .Decrypt(ref sentPackage.message);

        switch (package.packetInstructions)
        {
        case FFPacketInstructionFlags.MessageBoardGameObjectSend:
            FFMessageBoard <EventType> .SendToLocal(sentPackage.message, go);

            break;

        case FFPacketInstructionFlags.MessageBoardGameObjectSendDown:
            FFMessageBoard <EventType> .SendToLocalDown(sentPackage.message, go);

            break;

        case FFPacketInstructionFlags.MessageBoardGameObjectSendUp:
            FFMessageBoard <EventType> .SendToLocalUp(sentPackage.message, go);

            break;

        case FFPacketInstructionFlags.MessageBoardGameObjectSendToAllConnected:
            FFMessageBoard <EventType> .SendToLocalToAllConnected(sentPackage.message, go);

            break;

        default:
            break;
        }
    }
Пример #2
0
    void SendUpdateEvent(float dt)
    {
        RopeChange rc;

        rc.controller = this;
        rc.dt         = dt;
        FFMessageBoard <RopeChange> .SendToLocal(rc, gameObject);
    }
Пример #3
0
    public override bool SendToLocalEntry(FFBasePacket package, string entry)
    {
        FFPacket <EventType> sentPackage = (FFPacket <EventType>)package;

        FFPacket <EventType> .Decrypt(ref sentPackage.message);

        return(FFMessageBoard <EventType> .SendToLocal(sentPackage.message, entry));
    }
Пример #4
0
    void TriggerHealthEmpty()
    {
        EmptyHealthEvent e;

        e.currentHealth = currentHealth;
        FFMessageBoard <EmptyHealthEvent> .SendToLocal(e, gameObject);

        FFMessageBoard <EmptyHealthEvent> .SendToNet(e, gameObject, true);
    }
Пример #5
0
    // Update is called once per frame
    void OnUpdateEvent(FFLocalEvents.UpdateEvent e)
    {
        FFVector3 moveDirection;

        moveDirection.x = Input.GetAxis("Horizontal");
        moveDirection.y = Input.GetAxis("Vertical");
        moveDirection.z = 0;

        if (Vector3.Magnitude(moveDirection) >= 1)
        {
            moveDirection = Vector3.Normalize(moveDirection);
        }

        // optimization: Don't send if its not different from the last
        // move packet sent
        if (_moveVec != moveDirection)
        {
            ExPlayerMoveAction moveEvent;
            moveEvent.moveDirection = moveDirection;
            moveEvent.time          = FFSystem.time;
            moveEvent.position      = gameObject.transform.position;

            FFMessageBoard <ExPlayerMoveAction> .SendToLocal(moveEvent, gameObject);

            FFMessageBoard <ExPlayerMoveAction> .SendToNet(moveEvent, gameObject, false);

            _moveVec = moveDirection;
            //Debug.Log("Moving!"); // debug
        }



        if (Input.GetButtonDown("Fire1"))
        {
            ExPlayerFireAction ePFA;
            ePFA.position = transform.position + FiringLocation;
            ePFA.time     = FFSystem.time;

            FFMessageBoard <ExPlayerFireAction> .SendToLocal(ePFA, gameObject);

            FFMessageBoard <ExPlayerFireAction> .SendToNet(ePFA, gameObject, true);

            //Debug.Log("Fire1"); //debug
        }
    }
Пример #6
0
    void HandleInsideTrigger(Collider other)
    {
        if (wantsToUse && !useAreaBlocked)
        {
            UseEvent pue = new UseEvent();
            pue.player         = transform.parent; // Will be parent
            pue.BlockingAction = false;            // event output

            FFMessageBoard <UseEvent> .SendToLocal(pue, other.gameObject);

            // Player action is blocking
            useAreaBlocked = pue.BlockingAction;

            // disreguard playerwant to use when we become blocked by action
            wantsToUse = !pue.BlockingAction;
        }

        SetCursorDelayed(IdleSprite, Color.white, 0.15f);
    }