Exemplo n.º 1
0
    //=====================================================

    private void OnCastSpell(Vector3 target, ePlayerAction playerAction)
    {
        _spellTarget         = target;
        _currentPlayerAction = playerAction;

        OnPerformActionEvent();
    }
Exemplo n.º 2
0
    //=====================================================

    public void OnPlayerActionAvailable(ePlayerAction playerAction)
    {
        switch (playerAction)
        {
        default:
            _imgActionBtn.sprite = _sprActionDefault;
            break;

        case ePlayerAction.CLIMB_UP:
        case ePlayerAction.OPEN_CHEST:
            _imgActionBtn.sprite = _sprActionClimbUp;
            break;

        case ePlayerAction.CLIMB_DOWN:
        case ePlayerAction.CRAWL_THROUGH_DOOR:
        case ePlayerAction.ENTER_BOSS_ROOM:
        case ePlayerAction.ENTER_PLAYER_HUB:
        case ePlayerAction.ENTER_PUZZLE_ROOM:
        case ePlayerAction.LEAVE_BOSS_ROOM:
        case ePlayerAction.LEAVE_PLAYER_HUB:
        case ePlayerAction.LEAVE_PUZZLE_ROOM:
        case ePlayerAction.OPEN_DOOR:
        case ePlayerAction.PUSH_OBJECT:
        case ePlayerAction.TELEPORT_OBLIVION_PORTAL:
        case ePlayerAction.USE_FLOOR_LEVER:
        case ePlayerAction.USE_PRESSURE_SWITCH:
        case ePlayerAction.USE_WALL_LEVER:
            _imgActionBtn.sprite = _sprActionInteract;
            break;
        }
    }
Exemplo n.º 3
0
 private void PlayerAction(ePlayerAction action)
 {
     if (action == ePlayerAction.interact)
     {
         InteractWithEnvironment();
     }
 }
Exemplo n.º 4
0
    /// <summary>
    /// act out the players input
    /// </summary>
    /// <param name="action"></param>
    private void PlayerAction(ePlayerAction action)
    {
        if (cameraAnimationLocked)
        {
            return;
        }
        switch (action)
        {
        case ePlayerAction.jump:
            if (isGrounded && Inventory.instance.noJump == false)
            {
                Jumping();
            }
            break;

        case ePlayerAction.sprint:
            if (isGrounded)
            {
                speed = sprinting;
            }
            break;

        case ePlayerAction.walk:
            //Debug.Log("walking");
            speed = startSpeed;
            break;
        }
    }
Exemplo n.º 5
0
    public void SetAction(ePlayerAction _action)
    {
        if (_action != currentAction)
        {
            switch (_action)
            {
            case ePlayerAction.Stand:
                break;
                theAnimator.SetTrigger("doStand");
                break;

            case ePlayerAction.JumpUp:
                theAnimator.SetTrigger("StartJump");
                break;

            case ePlayerAction.Climb:
                theAnimator.SetTrigger("startClimb");
                break;

            default:
                break;
            }
            currentAction = _action;
        }
    }
Exemplo n.º 6
0
    void InstantiateHelpLine(ePlayerAction action, KeyCode keyboardKey)
    {
        HelpLine helpLine = Instantiate(_helpLine, transform);

        helpLine._actionText.text     = action.ToString();
        helpLine._keyBoardText.text   = keyboardKey.ToString();
        helpLine._controllerText.text = "";
    }
Exemplo n.º 7
0
 public static KeyCode GetKeyCode(ePlayerAction _action)
 {
     if (_actionsByKey == null)
     {
         InitializeDualDictionaries();
     }
     return(_keysByAction[_action]);
 }
Exemplo n.º 8
0
    //=====================================================

    private static void ClearCurrentAction()
    {
        _currentPlayerAction      = ePlayerAction.NULL;
        _currentInteractiveObject = null;

        if (GuiManager.Instance != null)
        {
            GuiManager.Instance.OnPlayerActionAvailable(_currentPlayerAction);
        }
    }
Exemplo n.º 9
0
    Dictionary <ePlayerAction, bool> GetKeyActions(KeyHandlerInfo keyHandlerInfo)
    {
        Dictionary <ePlayerAction, bool>  keyActions = new Dictionary <ePlayerAction, bool>();
        Dictionary <KeyCode, KeyCodeInfo> keys       = keyHandlerInfo._keysInterfaced;

        foreach (KeyCode key in keys.Keys)
        {
            ePlayerAction action = InputSettings.GetAction(key);
            KeyCodeInfo   kci    = keys[key];
            keyActions[action] = kci._keyCodeInfo[eInput.Up];
        }
        return(keyActions);
    }
Exemplo n.º 10
0
    /// <summary>
    /// move within a scene
    /// </summary>
    private void TeleportInScene(ePlayerAction action)
    {
        if (action != ePlayerAction.teleport)
        {
            return;
        }

        if (instance == null || instance.teleportPositions.Length < 1)
        {
            return;
        }
        instance.InstanceTeleportInScene();
    }
Exemplo n.º 11
0
    private void PlayerAction(ePlayerAction action)
    {
        if (action == ePlayerAction.interact && !alreadyTriggered && inRange)
        {
            alreadyTriggered = true;

            Debug.Log("e");
            if (cameraPan)
            {
                cameraPan.LockAndMoveCamera();
            }
            StartCoroutine(WanderingMask());
            Inventory.OwnsMask = true;
        }
    }
Exemplo n.º 12
0
    public void ChangedAction(ePlayerAction state)
    {
        switch (state)
        {
        case ePlayerAction.RUN:
            _naviMesh.enabled          = true;
            _naviMesh.speed            = 6.5f;
            _naviMesh.stoppingDistance = 0;
            break;

        case ePlayerAction.IDEL:
            _naviMesh.enabled = false;
            break;
        }
        _aniCtrl.SetInteger("AniState", (int)state);
        _curState = state;
    }
Exemplo n.º 13
0
    //=====================================================
    // Store available playerAction and gameObject
    // - action checked and activated when player uses Action button (see OnPerformActionEvent) e.g. open door
    public static void OnActionOk(ePlayerAction playerAction, IPlayerInteraction interactiveObject = null, Transform spawnPoint = null)
    {
        if (playerAction != ePlayerAction.NULL)
        {
            _currentPlayerAction      = playerAction;
            _currentInteractiveObject = interactiveObject;
            _currentSpawnPoint        = spawnPoint;

            if (GuiManager.Instance != null)
            {
                GuiManager.Instance.OnPlayerActionAvailable(_currentPlayerAction);
            }
        }
        else
        {
            ClearCurrentAction();
        }
    }
Exemplo n.º 14
0
 private void OnTriggerEnter2D(Collider2D collision)
 {
     if (collision.gameObject.CompareTag("Purify"))
     {
         state = ePlayerAction.Purify;
         uiCon.updateState();
     }
     if (collision.gameObject.CompareTag("Ignore"))
     {
         state = ePlayerAction.Ignore;
         uiCon.updateState();
     }
     if (collision.gameObject.CompareTag("Save"))
     {
         state = ePlayerAction.Save;
         uiCon.updateState();
     }
     if (collision.gameObject.CompareTag("Nothing"))
     {
         state = ePlayerAction.Nothing;
         uiCon.updateState();
     }
 }
Exemplo n.º 15
0
    // Use this for initialization
    void Start()
    {
        malNum = 0;
        bilNum = 0;
        effArr = new List <Effect>();
        effArr.Add(cardP.malaria);
        effArr.Add(cardP.bilharzia);
        gameControl.ef1 = effArr.ToArray();
        infMal          = false;
        infBil          = false;
        ignoreNum       = 0;
        purifyNum       = 0;

        noEffect  = new Effect("No effect", 0, false);
        savedFood = new Food("No food", 0, noEffect, 0);
        temp      = new Food("No food", 0, noEffect, 0);
        rb        = GetComponent <Rigidbody2D>();
        playerHP  = 15;
        uiCon.updatePlayerHP();

        takeAction = false;
        state      = ePlayerAction.Nothing;
    }
Exemplo n.º 16
0
    static void InitializeDualDictionaries()
    {
        _actionsByKey = new Dictionary <KeyCode, ePlayerAction>
        {
            { InputConfigs._mapScrollUp, ePlayerAction.ScrollUp },
            { InputConfigs._mapScrollDown, ePlayerAction.ScrollDown },
            { InputConfigs._mapScrollLeft, ePlayerAction.ScrollLeft },
            { InputConfigs._mapScrollRight, ePlayerAction.ScrollRight },


            { InputConfigs._changeView, ePlayerAction.ChangeView },
            { InputConfigs._changePlayers, ePlayerAction.ChangePlayer },
            { InputConfigs._endTurn, ePlayerAction.EndTurn },
            { InputConfigs._pause, ePlayerAction.Pause },
            { InputConfigs._help, ePlayerAction.Help },
        };
        _keysByAction = new Dictionary <ePlayerAction, KeyCode>();
        foreach (KeyCode kc in _actionsByKey.Keys)
        {
            ePlayerAction action = _actionsByKey[kc];
            _keysByAction[action] = kc;
        }
    }
Exemplo n.º 17
0
    private void PlayerAction(ePlayerAction action)
    {
        // shift
        if (action == ePlayerAction.shift && available == true)
        {
            available = false;

            aud.Play("transition", false, false);

            if (realActive == true)
            {
                SwitchDimension(true);
            }
            else
            {
                SwitchDimension(false);
            }
        }
        // pause
        else if (action == ePlayerAction.pause)
        {
            PauseMenu();
        }
    }