Ejemplo n.º 1
0
    void Update()
    {
        //TEST
        if (bb.controller.GetControl(InputControlType.Back).IsPressed)
        {
            rsc.rumbleMng.AddContinousRumble(RumbleId.TEST, playerId, weak, strong);
        }
        else
        {
            rsc.rumbleMng.RemoveContinousRumble(RumbleId.TEST, playerId);
        }

        if (bb.controller.GetControl(InputControlType.LeftTrigger).IsPressed)
        {
            rsc.camerasMng.AddContinousEffect(EffectId.TEST, 0, shake);
        }
        else
        {
            rsc.camerasMng.RemoveContinousEffect(EffectId.TEST, 0);
        }

        //END TEST

        if (bb.active && bb.alive)
        {
            //Reset flags
            if (!bb.shootPressed)
            {
                rsc.rumbleMng.RemoveContinousRumble(RumbleId.PLAYER_SHOOT, playerId);
            }
            rsc.rumbleMng.RemoveContinousRumble(RumbleId.PLAYER_DISINFECT, playerId);

            bb.ResetFlagVariables();

            if (bb.contactFlag && currentState != null)
            {
                ChangeStateIfNotNull(currentState.EnemyContactOnInvulnerabilityEnd());
            }

            currentState.RetrieveInput();
            //RechargeMovingCharge();

            if (currentState != null)
            {
                ChangeStateIfNotNull(currentState.Update());
            }

            if (gameObject.activeSelf) //Check to avoid a warning trying to update CharacterController if we just died and deactivated gameObject
            {
                UpdatePosition();
            }

            //Show arrow to boss if needed
            GameObject worm = rsc.enemyMng.GetWormGOIfNotVisible();
            if (worm != null)
            {
                bossIndicator.SetActive(true);
                Vector3 wormPos = worm.transform.position;
                wormPos.y = bossIndicator.transform.position.y;

                bossIndicator.transform.LookAt(wormPos);
            }
            else
            {
                bossIndicator.SetActive(false);
            }
        }
    }