Exemplo n.º 1
0
        private void onTutorialComplete(TutorialDefinition definition)
        {
            TutorialManager tutorialManager = Service.Get <TutorialManager>();

            tutorialManager.TutorialCompleteAction = (Action <TutorialDefinition>)Delegate.Remove(tutorialManager.TutorialCompleteAction, new Action <TutorialDefinition>(onTutorialComplete));
            State = DivingState.HoldingBreath;
        }
Exemplo n.º 2
0
 private void handleEnteringFreeAirZone(Collider zoneCollider)
 {
     if (!targetColor.Equals(PLENTIFUL_AIR_BUBBLE_COLOR))
     {
         turnPlentifulAreaTriggerLightsOn(zoneCollider.gameObject.GetComponent <FreeAirZone>(), isOn: true);
         bubbleState = BubbleState.TransitionToPlentifulAir;
         updateBubbleState();
         State = DivingState.PlentifulAir;
     }
 }
Exemplo n.º 3
0
 private void initializeDiving()
 {
     surface = mutableData.ResurfaceTransform.position.y;
     State   = DivingState.HoldingBreath;
     Content.LoadAsync(onBubbleloaded, shareBubbleContentKey);
     if (isLocalPlayer)
     {
         dispatcher.DispatchEvent(default(DivingEvents.ShowHud));
         dispatcher.AddListener <InputEvents.ActionEvent>(OnAction);
         dispatcher.AddListener <DivingEvents.EnableLocalInfiniteAir>(onEnableLocalInfiniteAir);
         dispatcher.AddListener <DivingEvents.DisableLocalInfiniteAir>(onDisableLocalInfiniteAir);
     }
 }
    public void Execute(Player player)
    {
        if (Input.GetKeyDown(KeyCode.LeftControl))
        {
            DivingState divingState = new DivingState();
            divingState.Enter(player);
        }

        timeInAir += Time.time;

        if (Physics.Raycast(player.transform.position, Vector3.down, 0.5f) && timeInAir > Time.time)
        {
            StandingState standingState = new StandingState();
            standingState.Enter(player);
        }
    }
Exemplo n.º 5
0
    public void Execute(Player player)
    {
        if (Input.GetKeyDown(KeyCode.S))
        {
            DivingState divingState = new DivingState();
            divingState.Enter(player);
        }

        jumpTime += Time.time;

        if (Physics.Raycast(player.transform.position, Vector3.down, 1f) && 2 * jumpTime > Time.time)
        {
            StandingState standingState = new StandingState();
            standingState.Enter(player);
        }
    }
Exemplo n.º 6
0
        private void OnTriggerExit(Collider other)
        {
            if (isLocalPlayer && other.gameObject != base.gameObject && !other.transform.IsChildOf(base.transform) && (bool)other.gameObject.GetComponent <FreeAirZone>())
            {
                turnPlentifulAreaTriggerLightsOn(other.gameObject.GetComponent <FreeAirZone>(), isOn: false);
                setBubbleColor(new Color32(byte.MaxValue, byte.MaxValue, byte.MaxValue, byte.MaxValue));
                State = DivingState.HoldingBreath;
                logEnterNoAirBI();
            }
            ShareBubble component = other.gameObject.GetComponent <ShareBubble>();

            if (component != null && !other.transform.IsChildOf(base.transform))
            {
                DivingGameController componentInParent = other.gameObject.GetComponentInParent <DivingGameController>();
                if (componentInParent != null)
                {
                    overlappingBubbles.Remove(componentInParent);
                }
            }
        }
Exemplo n.º 7
0
 public void RemotePlayerRemoved(DivingGameController controller)
 {
     if (!isLocalPlayer)
     {
         return;
     }
     if (controller != null)
     {
         overlappingBubbles.Remove(controller);
     }
     if (overlappingBubbles.Count == 0)
     {
         State = DivingState.HoldingBreath;
         Service.Get <INetworkServicesManager>().PlayerStateService.SetAirBubble(AirSupply, (int)State);
         dispatcher.DispatchEvent(new DivingEvents.FreeAirEffects(enabled: false, base.gameObject.tag));
         FreeAirZone componentInChildren = base.gameObject.GetComponentInChildren <FreeAirZone>();
         if (componentInChildren != null)
         {
             UnityEngine.Object.Destroy(componentInChildren);
         }
     }
 }
Exemplo n.º 8
0
    public void Awake()
    {
        Input      = GetComponent <IPlayerInput>();
        Anim       = GetComponent <IPlayerAnimationManager>();
        RollHitbox = GetComponent <PlayerRollAttackHitbox>();
        DiveHitbox = GetComponent <PlayerDiveAttackHitbox>();
        Motor      = GetComponent <PlayerMotor>();

        Walking         = new WalkingState(this);
        StandardJumping = new StandardJumpingState(this);
        DoubleJumping   = new DoubleJumpingState(this);
        RollJumping     = new RollJumpingState(this);
        SideFlipJumping = new SideFlipJumpingState(this);
        FreeFall        = new FreeFallState(this);
        WallSliding     = new WallSlidingState(this);
        WallJumping     = new WallJumpingState(this);
        Rolling         = new RollingState(this);
        Diving          = new DivingState(this);
        Bonking         = new BonkingState(this);
        GrabbingLedge   = new GrabbingLedgeState(this);

        _allStates = new[]
        {
            Walking,
            FreeFall,
            WallSliding,
            WallJumping,
            Rolling,
            Diving,
            Bonking,
            GrabbingLedge
        };

        // Start in FreeFall
        ChangeState(FreeFall);

        Debug.Log("Jump speed: " + PlayerConstants.STANDARD_JUMP_VSPEED);
    }
Exemplo n.º 9
0
        private void OnRemotePlayerAirBubbleChanged(AirBubble airBubble)
        {
            if (airBubble.value > 10f)
            {
                airBubble.value = 10f;
            }
            if (airBubble.value < 0f)
            {
                airBubble.value = 0f;
            }
            AirSupply = airBubble.value;
            DivingState diveState = (DivingState)airBubble.diveState;

            if (diveState != 0)
            {
                State = diveState;
            }
            float num = AirSupply / 10f;

            if (bubble != null)
            {
                bubble.transform.localScale = new Vector3(num, num, num);
            }
        }
Exemplo n.º 10
0
        private void OnTriggerEnter(Collider other)
        {
            if (isLocalPlayer)
            {
                if (other.gameObject != base.gameObject && !other.transform.IsChildOf(base.transform) && (bool)other.gameObject.GetComponent <FreeAirZone>())
                {
                    handleEnteringFreeAirZone(other);
                }
                else if (other.gameObject.CompareTag("TutorialTrigger") && Service.Get <TutorialManager>().TryStartTutorial(FindingAirTutorialDefinition.Id))
                {
                    State = DivingState.PlentifulAir;
                }
            }
            ShareBubble component = other.gameObject.GetComponent <ShareBubble>();

            if (component != null && !other.transform.IsChildOf(base.transform))
            {
                DivingGameController componentInParent = other.gameObject.GetComponentInParent <DivingGameController>();
                if (componentInParent != null)
                {
                    overlappingBubbles.Add(componentInParent);
                }
            }
        }
Exemplo n.º 11
0
 private void startBubbleScreenWipe()
 {
     AirSupply = 10f;
     State     = DivingState.PlentifulAir;
     Content.LoadAsync(onResurfacePopupLoaded, resurfacePrefabKey);
 }