/**
     * \fn KeyFrameFinished
     * \brief Updates what the last keyframe played in the animation was.
     *
     *
     **/
    void KeyFrameFinished()
    {
        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Finished keyframe.");
        }

        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_KeyFrameFinishedReceivers);
        data.m_idata.Add(m_iCounter);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_TransformAnimatorKeyframeFinished };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        //Reset values.
        m_LastTransformValues = m_KeyFrames[m_iCounter];
        m_flPassedTime        = 0.0f;
        m_iCounter           += 1 * m_iCounterModifier;

        if (m_iCounter >= 0 && m_iCounter < m_KeyFrames.Length)
        {
            m_GoalTransformValues = m_KeyFrames[m_iCounter];
        }
    }
Beispiel #2
0
    /**
     * FUNCTION NAME: ChangeCounter
     * DESCRIPTION  : Changes counter values on event receiving.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void ChangeCounter()
    {
        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "LPK_CounterModify Event Dispatched");
        }

        //Set recharging
        m_bOnCooldown = true;

        //Event dispatch.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_CounterReceiver);

        if (m_eMode == LPK_CounterModifyMode.SET)
        {
            data.m_bData.Add(true);
        }
        else
        {
            data.m_bData.Add(false);
        }

        data.m_idata.Add(m_iValue);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_CounterModify };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        StartCoroutine(DelayTimer());
    }
Beispiel #3
0
    /**
     * \fn ChangeHealth
     * \brief Changes the health of the target object.
     *
     *
     **/
    void ChangeHealth()
    {
        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Health Change Event Dispatched");
        }

        //Set recharging
        m_bOnCooldown = true;

        //Create and dispatch a LPK_HealthModify event
        //Gather event data.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_HealthModificationReceiver);

        if (m_eMode == LPK_HealthModifyMode.ADD)
        {
            data.m_bData.Add(false);
        }
        else if (m_eMode == LPK_HealthModifyMode.SET)
        {
            data.m_bData.Add(true);
        }

        data.m_idata.Add(m_iValue);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_HealthModified };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        StartCoroutine(DelayTimer());
    }
    /**
     * FUNCTION NAME: JumpInputPress
     * DESCRIPTION  : Manages jump input if set to respond to PRESS.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void JumpInputPress()
    {
        if (!string.IsNullOrEmpty(m_JumpButton) && Input.GetButtonDown(m_JumpButton))
        {
            //If the character is grounded
            if (m_GroundedInfo.m_bGrounded)
            {
                //Apply upward velocity based on specified speed
                m_cRigidBody.velocity      = new Vector3(m_cRigidBody.velocity.x, m_flJumpSpeed, 0);
                m_GroundedInfo.m_bGrounded = false;
                m_iDelayFrame = 2;

                m_bIsJumping = true;

                //Dispatch Jump
                LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_CharacterJumpEventReceivers);

                LPK_EventList sendEvent = new LPK_EventList();
                sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_CharacterJump };

                LPK_EventManager.InvokeEvent(sendEvent, data);

                if (m_bPrintDebug)
                {
                    LPK_PrintError(this, "Jumping via PRESS input.");
                }
            }

            //If character isnt grounded but air jump is enabled and available
            else if (m_iMaxAirJumps >= 1 && m_iAirJumpsUsed < m_iMaxAirJumps)
            {
                m_iAirJumpsUsed++;

                //Apply upward velocity based on specified speed
                if (m_bAirJumpDecreaseVelocity)
                {
                    m_cRigidBody.velocity = new Vector3(m_cRigidBody.velocity.x, (m_flJumpSpeed) / m_iAirJumpsUsed, 0);
                }
                else
                {
                    m_cRigidBody.velocity = new Vector3(m_cRigidBody.velocity.x, m_flJumpSpeed, 0);
                }

                m_bIsJumping = true;

                //Dispatch Jump
                LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_CharacterJumpEventReceivers);

                LPK_EventList sendEvent = new LPK_EventList();
                sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_CharacterJump };

                LPK_EventManager.InvokeEvent(sendEvent, data);

                if (m_bPrintDebug)
                {
                    LPK_PrintError(this, "Air jump via PRESS input.");
                }
            }
        }
    }
Beispiel #5
0
    /**
     * FUNCTION NAME: StopVibration
     * DESCRIPTION  : Stop vibration and send out appropriate event.  Also manages cooldown since a Corutine delay results
     *                in some unfortunate behavior.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void StopVibration()
    {
        //Stop vibration based on the controller number selected.
        for (int i = 0; i < m_pGamepads.Count; i++)
        {
            if ((int)m_pGamepads[i].m_iID != (int)m_eControllerNumber && m_eControllerNumber != LPK_ControllerNumber.ALL)
            {
                continue;
            }

            m_pGamepads[i].Rumble(0.0f, m_vecLeftRightMods);
        }

        m_flCurDuration += Time.deltaTime;

        //Cool down time is over.
        if (m_flCurDuration >= m_flCoolDown + m_flVibrateDuration)
        {
            if (m_bPrintDebug)
            {
                LPK_PrintDebug(this, "Stopping Controller Vibration");
            }

            //Dispatch event.
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_VibrationStopReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_InputEventTrigger = new LPK_EventList.LPK_INPUT_EVENTS[] { LPK_EventList.LPK_INPUT_EVENTS.LPK_VibrationStop };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            m_bActive = false;
        }
    }
    /**
     * \fn CountUp
     * \brief Detects when timer has finished counting up.
     *
     *
     **/
    void CountUp()
    {
        //Send out event.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TimerCompletedReceiver);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_TimerCompleted };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Timer Completed");
        }

        if (m_eTimerPolicy == LPK_TimerPolicy.RESET)
        {
            m_flCurrentTime = 0.0f;
            SetTime();
        }
        else
        {
            m_bPaused = true;
        }
    }
Beispiel #7
0
    void RespondToCollision(int otherTeamID)
    {
        //If the otherObject belongs to the same team, send LPK_AllyCollision
        if (otherTeamID == m_iTeam)
        {
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TeamCollisionReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_AllyCollision };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            if (m_bPrintDebug)
            {
                LPK_PrintDebug(this, "Ally Collision Event Dispatched");
            }
        }

        //If the otherObject belongs to a different team, send LPK_EnemyCollision
        if (otherTeamID != m_iTeam)
        {
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TeamCollisionReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_EnemyCollision };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            if (m_bPrintDebug)
            {
                LPK_PrintDebug(this, "Enemy Collision Event Dispatched");
            }
        }
    }
Beispiel #8
0
    /**
     * FUNCTION NAME: OnEvent
     * DESCRIPTION  : Manages object movement towards the next node in the path.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void MoveAlongPath()
    {
        if (m_bReachedNode)
        {
            return;
        }

        if (m_Nodes.Length <= 0)
        {
            return;
        }

        transform.position = Vector3.MoveTowards(transform.position, m_Nodes[m_iCounter].transform.position, Time.deltaTime * m_flSpeed);

        if (transform.position == m_Nodes[m_iCounter].transform.position)
        {
            m_bReachedNode = true;

            //Dispatch event.
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_ReachNodeReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_AIEventTrigger = new LPK_EventList.LPK_AI_EVENTS[] { LPK_EventList.LPK_AI_EVENTS.LPK_PathFollowerReachNode };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            if (m_bPrintDebug)
            {
                LPK_PrintDebug(this, "Reached Node");
            }
        }
    }
Beispiel #9
0
    /**
     * FUNCTION NAME: OnEvent
     * DESCRIPTION  : Sets detecing death events.
     * INPUTS       : data - Event data to parse for validation.
     * OUTPUTS      : None
     **/
    override protected void OnEvent(LPK_EventManager.LPK_EventData data)
    {
        //Incorrect object.
        if (!ShouldRespondToEvent(data))
        {
            return;
        }

        --m_iLives;

        UpdateDisplay();

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Character Died");
            LPK_PrintDebug(this, "Current Lives: " + m_iLives);
        }

        //Dispatch out of lives
        if (m_iLives <= 0)
        {
            LPK_EventManager.LPK_EventData newData = new LPK_EventManager.LPK_EventData(gameObject, m_OutOfLivesReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_OutOfLives };

            LPK_EventManager.InvokeEvent(sendEvent, newData);
        }
    }
Beispiel #10
0
    /**
     * FUNCTION NAME: DispatchDecreaseEvent
     * DESCRIPTION  : Sends counter decreased event.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchDecreaseEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_CounterDecreasedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_CounterDecrease };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
    /**
     * \fn DispatchDestructionEvent
     * \brief Sends out the object destroyed event.
     *
     *
     **/
    void DispatchDestructionEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, ObjectDeletedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_GameObjectDestroy };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
    /**
     * FUNCTION NAME: DispatchEvent
     * DESCRIPTION  : Dispatch audio levels adjusted event.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchEvent()
    {
        //Event dispatch.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(null, null);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_OptionManagerEventTrigger = new LPK_EventList.LPK_OPTION_MANAGER_EVENTS[] { LPK_EventList.LPK_OPTION_MANAGER_EVENTS.LPK_AudioLevelsAdjusted };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
Beispiel #13
0
    /**
     * FUNCTION NAME: UpdateDisplay
     * DESCRIPTION  : Sends display update change event.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void UpdateDisplay()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_DisplayUpdateReceiver);
        data.m_flData.Add(m_iValue);
        data.m_flData.Add(m_iMaxValue);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_DisplayUpdate };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
    /**
     * FUNCTION NAME: Unpause
     * DESCRIPTION  : Resumes the scene and the actions of any LPK component.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    public static void Unpause()
    {
        Time.timeScale = 1.0f;

        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(null, null);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_PauseEventTrigger = new LPK_EventList.LPK_PAUSE_EVENTS[] { LPK_EventList.LPK_PAUSE_EVENTS.LPK_GameUnpaused };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
Beispiel #15
0
    /**
     * FUNCTION NAME: OnEvent
     * DESCRIPTION  : Event responding.
     * INPUTS       : data - Event data to parse for validation.
     * OUTPUTS      : None
     **/
    protected override void OnEvent(LPK_EventManager.LPK_EventData data)
    {
        //Event validation.
        if (!ShouldRespondToEvent(data))
        {
            return;
        }

        //Dispatch events here.
        LPK_EventManager.LPK_EventData sendData = new LPK_EventManager.LPK_EventData(gameObject, m_RelayedEventReceivers);
        LPK_EventManager.InvokeEvent(m_RelayedEvents, sendData);
    }
Beispiel #16
0
    /**
     * FUNCTION NAME: UpdateDisplay
     * DESCRIPTION  : Invokes the UpdateDisplay events for objects that may be subscribed.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void UpdateDisplay()
    {
        //Gather event data.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_DisplayUpdateReceivers);
        data.m_flData.Add(m_iLives);
        data.m_flData.Add(m_iStatingLives);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_DisplayUpdate };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
    /**
     * FUNCTION NAME: DispatchAnimationCycleEvent
     * DESCRIPTION  : Sends event out for a cycle of the animation being finished.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchAnimationCycleEvent()
    {
        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Animation cycle event dispatched.");
        }

        LPK_EventManager.LPK_EventData newData = new LPK_EventManager.LPK_EventData(gameObject, m_AnimatorCycleFinishedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_AnimationCycleFinished };

        LPK_EventManager.InvokeEvent(sendEvent, newData);
    }
    /**
     * FUNCTION NAME: DispatchGradientFinishedEvent
     * DESCRIPTION  : Send out event when a gradient finishes an animation cycle.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchGradientFinishedEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_GradientFinishedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_GradientAnimationFinished };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Event dispatched");
        }
    }
    /**
     * \fn DispatchLPKMouseInputEvent
     * \brief Dispatches the mouse event and prints debug info if set.
     *
     *
     **/
    void DispatchLPKMouseInputEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_InputReceiver);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_InputEventTrigger = new LPK_EventList.LPK_INPUT_EVENTS[] { LPK_EventList.LPK_INPUT_EVENTS.LPK_MouseInput };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Mouse Input dispatched");
        }
    }
    /**
     * \fn DispatchMaintainEvent
     * \brief Dispatches the maintained LOS event.
     * \param target - Object that was seen.  Only used for debug logging here.
     *
     **/
    void DispatchMaintainEvent(GameObject target)
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_LineOfSightMaintainedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_AIEventTrigger = new LPK_EventList.LPK_AI_EVENTS[] { LPK_EventList.LPK_AI_EVENTS.LPK_LineOfSightMaintained };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Line of sight maintained between " + m_pSource.name + " and " + target);
        }
    }
Beispiel #21
0
    /**
     * FUNCTION NAME: DispatchLostEvent
     * DESCRIPTION  : Send out a lost event.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchLostEvent()
    {
        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Enemy lost");
        }

        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_LostEnemyReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_AIEventTrigger = new LPK_EventList.LPK_AI_EVENTS[] { LPK_EventList.LPK_AI_EVENTS.LPK_PathFollowerLostEnemy };

        LPK_EventManager.InvokeEvent(sendEvent, data);
    }
    /**
     * \fn TypeUIText
     * \brief Plays typing animation for UI text.
     *
     *
     **/
    void TypeUIText()
    {
        m_flDelay = m_flSpeed;

        //Extra delay for a comma.
        if (m_aCharacters[m_iCounter] == "," || m_aCharacters[m_iCounter] == ";")
        {
            m_flDelay += m_flCommaPauseTime;
        }

        //Extra delay for end of sentence quotations.
        else if (m_aCharacters[m_iCounter] == "." || m_aCharacters[m_iCounter] == "?" || m_aCharacters[m_iCounter] == "!" || m_aCharacters[m_iCounter] == ":")
        {
            m_flDelay += m_flPunctuationPauseTime;
        }

        //Notifying the owner that a letter has been typed.  Could be used for audio, for example.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TypingUpdateReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_TypingTextUpdate };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Typing effect update.");
        }

        //Inputing the new text.
        m_cText.text       = m_sPreviosulyTyped + m_aCharacters[m_iCounter];
        m_sPreviosulyTyped = m_cText.text;
        m_iCounter++;

        //Marks the text as finished.
        if (m_cText.text == m_sText)
        {
            TypingFinished();
        }

        //Typing the next letter.
        else
        {
            m_bActive = false;
            StartCoroutine(DelayType());
        }
    }
    /**
     * FUNCTION NAME: DispatchButtonEvent
     * DESCRIPTION  : Send out event for virtual button input.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchButtonEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_VirtualButtonReceivers);
        data.m_sPressedButton = m_sButton;

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_InputEventTrigger = new LPK_EventList.LPK_INPUT_EVENTS[] { LPK_EventList.LPK_INPUT_EVENTS.LPK_ButtonInput };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Button event dispatched");
        }
    }
    /**
     * \fn UICharacterScroll
     * \brief Plays typing animation for UI character scroll display.
     *
     *
     **/
    void UICharacterScroll()
    {
        m_flDelay = m_flSpeed;

        //Extra delay for a comma.
        if (m_aCharacters[m_iCounter].ToCharArray()[0] >= ' ' && m_aCharacters[m_iCounter].ToCharArray()[0] <= '/')
        {
            m_sLastChar = m_aCharacters[m_iCounter].ToCharArray()[0];
        }

        //Inputing the new text.
        m_cText.text = m_sPreviosulyTyped + m_sLastChar;

        if (m_cText.text.Length > 0 && m_cText.text[m_cText.text.Length - 1] == m_aCharacters[m_iCounter].ToCharArray()[0])
        {
            //Notifying the owner that a letter has been typed.  Could be used for audio, for example.
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TypingUpdateReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_TypingTextUpdate };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            if (m_bPrintDebug)
            {
                LPK_PrintDebug(this, "Typing effect update.");
            }

            m_iCounter++;
            m_sPreviosulyTyped = m_cText.text;
            m_sLastChar        = '0';
        }

        //Marks the text as finished.
        if (m_cText.text == m_sText)
        {
            TypingFinished();
        }

        //Typing the next letter.
        else
        {
            m_bActive = false;
            m_sLastChar++;
            StartCoroutine(DelayType());
        }
    }
    /**
     * FUNCTION NAME: JumpInputHold
     * DESCRIPTION  : Manages jump input if set to respond to HOLD.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void JumpInputHold()
    {
        //Resets data on initial button press.
        if (!string.IsNullOrEmpty(m_JumpButton) && Input.GetButtonDown(m_JumpButton))
        {
            if (m_iAirJumpsUsed > m_iMaxAirJumps)
            {
                return;
            }

            if (!m_GroundedInfo.m_bGrounded)
            {
                m_iAirJumpsUsed++;
            }

            m_flAirTime  = 0.0f;
            m_bIsJumping = true;

            //Dispatch event.
            LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_CharacterJumpEventReceivers);

            LPK_EventList sendEvent = new LPK_EventList();
            sendEvent.m_CharacterEventTrigger = new LPK_EventList.LPK_CHARACTER_EVENTS[] { LPK_EventList.LPK_CHARACTER_EVENTS.LPK_CharacterJump };

            LPK_EventManager.InvokeEvent(sendEvent, data);

            m_cRigidBody.velocity = new Vector3(m_cRigidBody.velocity.x, m_flJumpSpeed, 0);

            if (m_bPrintDebug)
            {
                LPK_PrintError(this, "Jumping via HOLD input.");
            }
        }

        //Manages actual velocity change.
        if (!string.IsNullOrEmpty(m_JumpButton) && Input.GetButton(m_JumpButton) && m_flAirTime <= m_flMaxAirTime)
        {
            if (m_iAirJumpsUsed > m_iMaxAirJumps)
            {
                return;
            }

            m_cRigidBody.velocity = new Vector3(m_cRigidBody.velocity.x, m_flJumpSpeed, 0);

            m_flAirTime += Time.deltaTime;
        }
    }
Beispiel #26
0
    /**
     * \fn DestroyOwner
     * \brief Destroy this object's owner and send out the event.
     *
     *
     **/
    void DestroyOwner()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, ObjectDeletedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_GameObjectDestroy };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        Object.Destroy(gameObject);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Object Destroyed");
        }
    }
    /**
     * FUNCTION NAME: DispatchEvent
     * DESCRIPTION  : Dispatches the gamepad input event if conditions were met in CompareInputStates.
     * INPUTS       : None
     * OUTPUTS      : None
     **/
    void DispatchEvent()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, GamepadInputReceivers);
        data.m_PressedGamepadButton = m_eInputButton;
        data.m_PressedGamepadNumber = m_eControllerNumber;

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_InputEventTrigger = new LPK_EventList.LPK_INPUT_EVENTS[] { LPK_EventList.LPK_INPUT_EVENTS.LPK_GamepadInput };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Gamepad event dispatched");
        }
    }
    /**
     * \fn TypingFinished
     * \brief Disables effect and informs all receivers that this text is finished typing.
     *
     *
     **/
    void TypingFinished()
    {
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_TypingCompeltedReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_GameplayEventTrigger = new LPK_EventList.LPK_GAMEPLAY_EVENTS[] { LPK_EventList.LPK_GAMEPLAY_EVENTS.LPK_TypingTextComplete };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Typing effect finished.");
        }

        m_bActive = false;
    }
    /**
     * \fn DispatchFoundEvent
     * \brief Dispatches the lost LOS event.
     * \param target - Game object to remove from the found objects list.
     *
     **/
    void DispatchLostEvent(GameObject target)
    {
        //This object has been lost.
        m_pFoundObjects.Remove(target);

        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, m_LineOfSightLostReceivers);

        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_AIEventTrigger = new LPK_EventList.LPK_AI_EVENTS[] { LPK_EventList.LPK_AI_EVENTS.LPK_LineOfSightLost };

        LPK_EventManager.InvokeEvent(sendEvent, data);

        if (m_bPrintDebug)
        {
            LPK_PrintDebug(this, "Line of sight lost between " + m_pSource.name + " and " + target);
        }
    }
Beispiel #30
0
    //NOTENOTE:  Contains an example of how to invoke an event.  You could name this function whatever you want, have multiple invoke functions,
    //           or even invoke events inside of a function that is doing other things (NOT RECOMMENDED).
    void ExampleInvokeFunction()
    {
        //NOTENOTE:  LPK_EventData is a class that holds lists of many datatypes that could be used to send information via events.  This is done
        //           already in LPK_Timer if you wish to see a working example.  All data sent ==MUST== have a sender (which should be the game object
        //           this component is on), as well as receivers who will react to the event.  If the user chooses not to set any receivers, than
        //           anything looking for that event call will be activated.
        LPK_EventManager.LPK_EventData data = new LPK_EventManager.LPK_EventData(gameObject, ExampleEventReceivers);

        //NOTENOTE:  Send the event by creating a new LPK_EventList and setting the arrays to hold the events that are being invoked.  You can invoke as many
        //           events as you want in a single call this way.  The example below only invokes a keyboard input event.
        LPK_EventList sendEvent = new LPK_EventList();

        sendEvent.m_InputEventTrigger = new LPK_EventList.LPK_INPUT_EVENTS[] { LPK_EventList.LPK_INPUT_EVENTS.LPK_KeyboardInput };

        //NOTENOTE:  Invokes the event.  The first parameter is the list of events we are invoking, the second parameter holds the data made above.  This data
        //           contains information such as the sender of the event, the receiver list, etc.
        LPK_EventManager.InvokeEvent(sendEvent, data);
    }