Beispiel #1
0
    private void Die()
    {
        TurnCharacter dataChar = this.gameObject.GetComponent <UnityCharacterTurnInfo>().DataCharacter;

        // If the character dying is the active character, in case they died without firing, set the turn time to 7 seconds
        if (dataChar.CurrentState == CharacterState.active)
        {
            TurnTimer t = TurnTimer.Instance;

            t.SetTurnTime(7f);
        }

        dataChar.Die(); // At the end of the turn, the character will be set inactive since its state is now "dead"
    }
    public void StartTurnByNumber(int charNum)
    {
        CurrentTurnSegment = TurnSegments.gridMovement;

        gridMgr.SetAllNodeMatsActive(true);

        ActiveCharacters[charNum].StartTurn();

        ActiveCharacters[charNum].CharGO.GetComponent <CharacterGridMovement>().SetCurrentNode(); // Ensure char's current node is set
        ActiveCharacters[charNum].CharGO.GetComponent <CharacterGridMovement>().RefreshGridTurn();
        gridMgr.IdentifyMovableNodes(ActiveCharacters[charNum]);                                  // this has a functional dependency on the queried character having a "CurrentNode"

        MovingPlayer = ActiveCharacters[charNum].PlayerNumber;

        MovingCharInstance = ActiveCharacters[charNum].CharGO;

        turnTimer.SetTurnTime(TurnTime);

        NotifyOfSwitch?.Invoke();
    }
    private void UpdateCheckMoveSlice()
    {
        AbstractWeapon currentWeaponScript = CurrentWeapon.GetComponent <AbstractWeapon>();

        currentWeaponScript.CrosshairGO.SetActive(true);

        if (inputHdlr.RightKeyHeld && !firing && onGround)
        {
            rb.velocity = this.transform.right;

            billboardScript.IsFlipped = true;
        }

        if (inputHdlr.LeftKeyHeld && !firing && onGround)
        {
            rb.velocity = this.transform.right;

            billboardScript.IsFlipped = false;
        }

        if (inputHdlr.JumpKeyDown && !firing && onGround)
        {
            rb.velocity += Vector3.up * jumpForce;

            onGround = false;
        }

        if (inputHdlr.ChoiceBackKeyDown && !hasFired)
        {
            currentWeaponIndex--;

            if (currentWeaponIndex < 0)
            {
                currentWeaponIndex = weaponInstancesList.Count - 1;
            }

            SwitchToWeapon(currentWeaponIndex);
        }

        if (inputHdlr.ChoiceFwdKeyDown && !hasFired)
        {
            currentWeaponIndex++;

            if (currentWeaponIndex >= weaponInstancesList.Count)
            {
                currentWeaponIndex = 0;
            }

            SwitchToWeapon(currentWeaponIndex);
        }

        if (inputHdlr.UpKeyHeld)
        {
            currentWeaponScript.RotateUp();
        }

        if (inputHdlr.DownKeyHeld)
        {
            currentWeaponScript.RotateDown();
        }

        if (inputHdlr.ChoiceKeyDown && !hasFired)
        {
            hasFired = true;
            firing   = true;
        }

        if (inputHdlr.ChoiceKeyHeld && firing)
        {
            currentWeaponScript.ChargeShot();
        }

        if (firing && (inputHdlr.ChoiceKeyUp || currentWeaponScript.ShootPower >= currentWeaponScript.MaxShootPower))
        {
            firing       = false;
            turnFinished = true;

            CurrentWeapon.GetComponent <AbstractWeapon>().CrosshairGO.SetActive(false);

            turnTimer.SetTurnTime(7f);

            currentWeaponScript.Fire();
        }
    }