Exemplo n.º 1
0
    private void UpdateUse(float dt)
    {
        if (selectedObject != null)
        {
            //Debug.Log("Have Selected Object");
            if (Input.GetKeyDown(KeyCode.E))
            {
                //Debug.Log("UseBegin");

                UseBegin u = new UseBegin();
                u.user = gameObject;
                FFMessageBoard <UseBegin> .Send(u, selectedObject);
            }
            else if (Input.GetKey(KeyCode.E))
            {
                //Debug.Log("Using");

                Using u = new Using();
                u.user = gameObject;
                u.dt   = dt;
                FFMessageBoard <Using> .Send(u, selectedObject);

                if (u.valid)
                {
                    UpdatePlayerMessage(u.pm, 1.0f - (u.timeRemaining / u.timeToCompelte));
                }
            }
        }
        else
        {
            //Debug.Log("Don't Have selected Object");
        }
    }
Exemplo n.º 2
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;
        }
    }
Exemplo n.º 3
0
 void DestroyOnRope()
 {
     if (OnRope.rope != null)
     {
         FFMessageBoard <RopeChange> .Disconnect(OnRopeChange, OnRope.rope.gameObject);
     }
 }
Exemplo n.º 4
0
    // Use this for initialization
    void Start()
    {
        cursorDelaySeq = action.Sequence();
        FFMessageBoard <UnBlockUseArea> .Connect(OnUnBlockUseArea, gameObject);

        FFMessageBoard <BlockUseArea> .Connect(OnBlockUseArea, gameObject);
    }
Exemplo n.º 5
0
    // Update is called once per frame
    void Update()
    {
        float lightLevel = FindObjectOfType <GlobalLightChecker>().GetTotalLightLevel(transform);

        if ((!mCrying && lightLevel >= 1.5f) || (!mCrying && mGoCryHackSwitch))
        {
            mCrying = true;
            mMyActionList.ClearSequence();
            GetComponent <ExPathFollower>().enabled = false;
            StartCoroutine("GoCry");

            var text = "ScareAway";
            var box  = FFMessageBoard <CustomDialogOn> .Box((string)text);

            CustomDialogOn cdo;
            cdo.tag = (string)text;
            box.SendToLocal(cdo);
        }
        else if ((mCrying && GameMath.DistanceBetween(this, mCryingPlace) <= 3.0f && lightLevel >= 2.5f) || mBeCuredHackSwitch)
        {
            var text = "Rescue";
            var box  = FFMessageBoard <CustomDialogOn> .Box((string)text);

            CustomDialogOn cdo;
            cdo.tag = (string)text;
            box.SendToLocal(cdo);


            // Become human?
            Destroy(this);
        }
    }
Exemplo n.º 6
0
    private void OnDestroy()
    {
        FFMessageBoard <UseBegin> .Disconnect(OnUseBegin, gameObject);

        FFMessageBoard <Using> .Disconnect(OnUsing, gameObject);

        FFMessageBoard <QueryUsable> .Disconnect(OnQueryUsable, gameObject);
    }
Exemplo n.º 7
0
    void SendUpdateEvent(float dt)
    {
        RopeChange rc;

        rc.controller = this;
        rc.dt         = dt;
        FFMessageBoard <RopeChange> .SendToLocal(rc, gameObject);
    }
Exemplo n.º 8
0
    void SendLookAt(GameObject go)
    {
        //Debug.Log("PlayerInteract.SendLookAt");
        LookingAt lookAt = new LookingAt();

        lookAt.actor = interactorCamera.transform;
        FFMessageBoard <LookingAt> .SendToLocalToAllConnected(lookAt, go);
    }
Exemplo n.º 9
0
    void SendLooking(GameObject go)
    {
        //Debug.Log("PlayerInteract.SendLooking");
        Looking looking = new Looking();

        looking.actor = interactorCamera.transform;
        FFMessageBoard <Looking> .SendToLocalToAllConnected(looking, go);
    }
Exemplo n.º 10
0
    void SendUse(GameObject go)
    {
        //Debug.Log("PlayerInteract.SendUse");
        Use u = new Use();

        u.actor = transform;
        FFMessageBoard <Use> .SendToLocalToAllConnected(u, go);
    }
Exemplo n.º 11
0
    // Use this for initialization
    void Start()
    {
        FFMessageBoard <GiveCoins> .Connect(OnGiveCoin, gameObject);

        FFMessageBoard <GiveObject> .Connect(OnGiveObject, gameObject);

        UpdateUI();
    }
Exemplo n.º 12
0
    private void GrantCoins(PlayerInteract.Use e)
    {
        // Send out event to player
        GiveCoins gc;

        gc.coinCount = coinCount + Random.Range(-coinCountVarience, coinCountVarience);
        FFMessageBoard <GiveCoins> .SendToLocalToAllConnected(gc, e.actor.gameObject);
    }
Exemplo n.º 13
0
 // private Initialization function
 private static void GetReady()
 {
     if (messageBoardSystem == null)
     {
         messageBoardSystem = new FFMessageBoard <EventType>();
         FFPrivate.FFMessageSystem.AddMessageBoard(messageBoardSystem, typeof(EventType).ToString());
     }
 }
Exemplo n.º 14
0
    // Use this for initialization
    void Start()
    {
        FFMessageBoard <UseBegin> .Connect(OnUseBegin, gameObject);

        FFMessageBoard <Using> .Connect(OnUsing, gameObject);

        FFMessageBoard <QueryUsable> .Connect(OnQueryUsable, gameObject);
    }
Exemplo n.º 15
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));
    }
Exemplo n.º 16
0
    void SetupOnRope()
    {
        SetVelocityRef(new FFRef <Vector3>(
                           () => OnRope.rope.VelocityAtDistUpRope(OnRope.distUpRope),
                           (v) => {}));

        FFMessageBoard <RopeChange> .Connect(OnRopeChange, OnRope.rope.gameObject);
    }
Exemplo n.º 17
0
    void SendLookAway(GameObject go)
    {
        //Debug.Log("PlayerInteract.SendLookAway");
        LookingAway lookAway = new LookingAway();

        lookAway.actor = interactorCamera.transform;
        FFMessageBoard <LookingAway> .SendToLocalToAllConnected(lookAway, go);
    }
Exemplo n.º 18
0
    private void GrantObject(PlayerInteract.Use e)
    {
        // Send out event to player
        GiveObject giveObject;

        giveObject.ObjectName  = ObjectName;
        giveObject.objectCount = objectCount + Random.Range(-objectCountVarience, objectCountVarience);
        FFMessageBoard <GiveObject> .SendToLocalToAllConnected(giveObject, e.actor.gameObject);
    }
Exemplo n.º 19
0
    void SendCustomDialogEvent(object text)
    {
        var box = FFMessageBoard <CustomDialogOn> .Box((string)text);

        CustomDialogOn cdo;

        cdo.tag = (string)text;
        box.SendToLocal(cdo);
    }
Exemplo n.º 20
0
    void TriggerHealthEmpty()
    {
        EmptyHealthEvent e;

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

        FFMessageBoard <EmptyHealthEvent> .SendToNet(e, gameObject, true);
    }
Exemplo n.º 21
0
 void UseSelectedObject()
 {
     if (selectedObject != null)
     {
         UseBegin u = new UseBegin();
         u.user = gameObject;
         FFMessageBoard <UseBegin> .Send(u, selectedObject);
     }
 }
Exemplo n.º 22
0
    void OnDestroy()
    {
        FFMessageBoard <ApplyHealthEvent> .Disconnect(OnApplyHealth, gameObject);

        FFMessageBoard <EmptyHealthEvent> .Disconnect(OnHealthEmpty, gameObject);

        FFMessageBoard <ExHealth> .Disconnect(OnServerUpdate, gameObject);

        FFMessage <FFNetEvents.ClientConnectedEvent> .Disconnect(OnClientConnected);
    }
Exemplo n.º 23
0
    void OnDestroy()
    {
        // Events
        FFMessageBoard <ExPlayerMoveAction> .Disconnect(OnPlayerMoveAction, gameObject);

        FFMessageBoard <ExPlayerFireAction> .Disconnect(OnPlayerFireAction, gameObject);

        FFMessageBoard <ExPlayerPositionUpdate> .Disconnect(OnPlayerPositionUpdate, gameObject);

        FFMessage <FFLocalEvents.UpdateEvent> .Disconnect(OnUpdateEvent);
    }
Exemplo n.º 24
0
    private void UpdatePositionCall()
    {
        ExPlayerPositionUpdate e;

        e.position = transform.position;
        e.time     = FFSystem.time;
        FFMessageBoard <ExPlayerPositionUpdate> .SendToNet(e, gameObject, false);

        PositionUpdateSeq.Delay(0.6f);
        PositionUpdateSeq.Sync();
        PositionUpdateSeq.Call(UpdatePositionCall);
    }
Exemplo n.º 25
0
    private void OnDestroy()
    {
        FFMessageBoard <ConfigurePopup> .Disconnect(OnConfiurePopup, gameObject);

        FFMessageBoard <PlayerInteract.LookingAt> .Disconnect(OnLookAt, gameObject);

        FFMessageBoard <PlayerInteract.LookingAway> .Disconnect(OnLookAway, gameObject);

        FFMessageBoard <PlayerInteract.Looking> .Disconnect(OnLooking, gameObject);

        FFMessageBoard <PlayerInteract.Use> .Disconnect(OnUse, gameObject);
    }
Exemplo n.º 26
0
    // Use this for initialization
    void Start()
    {
        FFMessageBoard <ConfigurePopup> .Connect(OnConfiurePopup, gameObject);

        FFMessageBoard <PlayerInteract.LookingAt> .Connect(OnLookAt, gameObject);

        FFMessageBoard <PlayerInteract.LookingAway> .Connect(OnLookAway, gameObject);

        FFMessageBoard <PlayerInteract.Looking> .Connect(OnLooking, gameObject);

        FFMessageBoard <PlayerInteract.Use> .Connect(OnUse, gameObject);
    }
Exemplo n.º 27
0
    /// <summary>
    /// returns true if it could be sent to the net, if this box wasn't
    /// created via a FFMessageBoard it will not be able to send to Net
    /// </summary>
    public bool SendToNet(EventType e, bool varifiedPacket = false)
    {
        if (active && messageBoard != null)
        {
            messageBoard.IncrementCallCount();
            ++callCountLocal;
            FFMessageBoard <EventType> .SendToNet(e, entry, varifiedPacket);

            return(true);
        }
        Debug.LogError("Warning, an FFMessageBox which is not connected to a FFMessageBoard tried to SendToNet.");
        return(false);
    }
Exemplo n.º 28
0
    void AddDialog(CharacterDialog.Dialog dialog)
    {
        gameDialog.Add(dialog);

        foreach (var cond in dialog.condition)
        {
            if (cond.type == CharacterDialog.Dialog.Condition.Type.Custom)
            {
                FFMessageBoard <CustomDialogOn> .Box(cond.identifier).Connect(OnCustomDialogOn);

                FFMessageBoard <CustomDialogOff> .Box(cond.identifier).Connect(OnCustomDialogOff);
            }
        }
    }
Exemplo n.º 29
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
        }
    }
Exemplo n.º 30
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        Debug.Log("OnTrigger Entered 2d");
        QueryUsable qu = new QueryUsable();

        FFMessageBoard <QueryUsable> .Send(qu, collision.gameObject);


        if (qu.usableObject)
        {
            SelectUsableObject(qu);
            DisplayUsableObjectMessage(qu);
        }
        else
        {
            DeselectUsableObject(qu.gameObject);
        }
    }