Esempio n. 1
0
    private void BasicControlAssign()
    {
        moveX = 0;
        moveY = 0;
        if (Input.GetKey(KeyCode.W) || VirtualBttCanvas.isUpPress)
        {
            moveY = +1 * he.Direction0.y;
            moveX = +1 * he.Direction0.x;
        }
        if (Input.GetKey(KeyCode.S) || VirtualBttCanvas.isDownPress)
        {
            moveY = -1 * he.Direction0.y;
            moveX = -1 * he.Direction0.x;
        }
        if (Input.GetKey(KeyCode.A) || VirtualBttCanvas.isLeftPress)
        {
            he.Direction0 = Quaternion.Euler(0, 0, +1 * heroSpinSpeed * Time.deltaTime) * he.Direction0;
        }
        if (Input.GetKey(KeyCode.D) || VirtualBttCanvas.isRightPress)
        {
            he.Direction0 = Quaternion.Euler(0, 0, -1 * heroSpinSpeed * Time.deltaTime) * he.Direction0;
        }
        // Assign value
        moveVelocity = new Vector3(moveX, moveY);
        aimAngle     = Mathf.Atan2(he.Direction0.y, he.Direction0.x) * 180 / Mathf.PI;
        // Esc to quit the game
        if (Input.GetKeyDown(KeyCode.Escape) || VirtualBttCanvas.isEscapeClick)
        {
            VirtualBttCanvas.isEscapeClick = false;
            EventManager.Instance.UpdateEvent("HeroController_WayOutEvent_EndLevel",
                                              new PopupEventInfo {
                title      = "Why? :(",
                content    = "Are you really want to quit the level at this early?",
                okCallback = () => { LoadScene.LoadSceneName(SceneName.MainMenu); },
            });
        }
        if (Input.GetKey(KeyCode.L) && he.currentGun.GunType == GunType.Rifts ||
            Input.GetKey(KeyCode.L) && he.currentGun.GunType == GunType.AUG ||
            Input.GetKey(KeyCode.L) && he.currentGun.GunType == GunType.DualBerretas ||
            VirtualBttCanvas.isShootPress && he.currentGun.GunType == GunType.Rifts ||
            VirtualBttCanvas.isShootPress && he.currentGun.GunType == GunType.AUG ||
            VirtualBttCanvas.isShootPress && he.currentGun.GunType == GunType.DualBerretas)
        {
            isShooted = true;
        }
        else if (Input.GetKeyDown(KeyCode.L) || VirtualBttCanvas.isShootClick)
        {
            VirtualBttCanvas.isShootClick = false;

            isShooted = true;
        }
        if (Input.GetKeyDown(KeyCode.J) || VirtualBttCanvas.isChangeWeaponClick)
        {
            VirtualBttCanvas.isChangeWeaponClick = false;
            if (indexOfCurrentGun >= GameManager.instance.MAX_SLOTS - 1)
            {
                indexOfCurrentGun = -1;
            }
            indexOfCurrentGun++;
            he.currentGun = itemsList[indexOfCurrentGun];
            nextFire      = Time.time;
            EventManager.Instance.UpdateEvent("HeroController_PressChangingItem",
                                              new OnItemListInfo {
                indexOfCurrentGun = indexOfCurrentGun,
                itemsList         = itemsList
            });
        }
        if (Input.GetKeyDown(KeyCode.K) || VirtualBttCanvas.isFlashLightClick)
        {
            VirtualBttCanvas.isFlashLightClick = false;
            EventManager.Instance.UpdateEvent("HeroController_PressFlashLight", null);
            if (!isFlashOn)
            {
                isFlashOn = true;
                state     = State.Moving;
                he.flashLightTransform.gameObject.SetActive(true);
            }
            else
            {
                isFlashOn = false;
                state     = State.Running;
                he.flashLightTransform.gameObject.SetActive(false);
            }
        }
        if (Input.GetKey(KeyCode.I) || VirtualBttCanvas.isThrowClick)
        {
            VirtualBttCanvas.isThrowClick = false;
            Gun lastWeapon = he.currentGun;
            itemsList[indexOfCurrentGun] = GameManager.instance.knife;
            he.currentGun = itemsList[indexOfCurrentGun];

            EventManager.Instance.UpdateEvent("HeroController_ThrowAwayWeapon",
                                              new OnItemListInfo {
                gunType           = lastWeapon.GunType,
                playerPosition    = transform.position,
                indexOfCurrentGun = indexOfCurrentGun,
                itemsList         = itemsList
            });
        }
    }
Esempio n. 2
0
 public void RestartLevel()
 {
     LoadScene.LoadSceneName(SceneName.Gameplay);
 }
Esempio n. 3
0
 private void LoadSceneAction()
 {
     LoadScene.LoadSceneName(SceneName.Gameplay);
 }