示例#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;
        }
    }
    void OnCollisionEnter2D(Collision2D coll)
    {
        if (FFServer.isLocal)
        {
            if (Damage > 0)
            {
                // Send Messages
                ExHealth.ApplyHealthEvent e;
                e.amount = -Damage;
                e.time   = (float)FFSystem.time;
                e.group  = DamageGroup;

                FFMessageBoard <ExHealth.ApplyHealthEvent> .SendToLocalUp(e, coll.gameObject);

                FFMessageBoard <ExHealth.ApplyHealthEvent> .SendToNetUp(e, coll.gameObject, true);

                if (DestroyOnCollision)
                {
                    gameObject.Destroy();
                }
            }
        }
    }