Esempio n. 1
0
 public void ForceDisengage()
 {
     StartCoroutine(_userMovement.DisengageBlock(() =>
     {
         waitingForCallback = false;
         _blockEngaged = false;
         _pushableObject = null;
     }));
 }
Esempio n. 2
0
        void OnTriggerExit(Collider other)
        {
            var component = other.GetComponent<MonoBehaviour>();

            if (component as PushableBase != null)
            {
                if (!_userMovement.GetBlockEngaged())
                {
                    _pushableObject = null;
                }
                else if (_userMovement.AirState || _pushableObject.GetPushBlock().IsSlippery)
                {
                    StartCoroutine(_userMovement.DisengageBlock(() =>
                    {
                        waitingForCallback = false;
                        _blockEngaged = false;
                        _pushableObject = null;
                    }));
                }
            }
        }
Esempio n. 3
0
        void OnTriggerEnter(Collider other)
        {
            var component = other.GetComponent<MonoBehaviour>();

            if (component as PushableBase != null 
                && (component as PushableBase).IsEnabled())
            {
                _pushableObject = component as PushableBase;
            }

            if (component as DeathVolume != null)
            {

                if (SceneMap.GetSceneFromStringName(Application.loadedLevelName) == Scene.Level2)
                {
                    waitingForCallback = true;
                    StartCoroutine(_userMovement.DisengageBlock(() =>
                    {
                        waitingForCallback = false;
                        _blockEngaged = false;
                        _pushableObject = null;
                        StartCoroutine(GetComponent<PlayerAnimate>().GetMessedUp());
                    }));
                }
                //Pretty really bad && specific right here
                //I want to go back to the hub is a hand gets the player at the last room in lvl3
                //TODO: Put this somewhere appropriate
                else if (SceneMap.GetSceneFromStringName(Application.loadedLevelName) == Scene.Level3 
                    && FindObjectOfType<RoomWorkflow>().CurrentRoom.RoomIndex == 0
                    && FindObjectOfType<RoomWorkflow>().ReverseRooms)
                {
                    SoundManager.Instance.Play(SoundManager.SoundEffect.HurtNoise);

                    SignalrEndpoint.Instance.Broadcast(GuiManager.Instance.PlayerNameInput
                    + " was helped out of "
                    + SceneMap.DescriptiveName(SceneMap.GetSceneFromStringName(Application.loadedLevelName))
                    + "...");

                    Application.LoadLevel(SceneMap.GetScene(Scene.Hub));
                }
                else
                {
                    StartCoroutine(GetComponent<PlayerAnimate>().GetMessedUp());
                }

            }
        }
Esempio n. 4
0
        void ClimbInput()
        {
            if (waitingForCallback) return;
            if (_climbTarget == Vector3.zero) return;       //Don't climb if we don't get a valid target
            if (_userMovement.GetBlockEngaged()) return;    //Don't climb if you're pushing a block
            if (_userMovement.AirState) return;             //Don't climb if you're in the air

            //Draw climb button if we get this far
            GuiManager.Instance.DrawClimbPrompt();
            if (!InputManager.Instance.ClimbButton) return; //Don't climb if we're not pushing the button

            _pushableObject = null;

            waitingForCallback = true;
            StartCoroutine(_userMovement.ClimbGeometry(_climbTarget, () =>
            {
                waitingForCallback = false;
            }));
        }
Esempio n. 5
0
        public IEnumerator ClimbBlock(PushableBase pushableObject, Action action)
        {
            if (pushableObject.GetPushBlock().TopBlocked())
            {
                action();
                yield break;
            }

            iTween.MoveTo(gameObject,
                pushableObject.GetPushBlock().transform.position.SetY(pushableObject.GetPushBlock().transform.position.y + 2.5f), 
                .4f);
            action();

            yield break;
        }
Esempio n. 6
0
        //TODO: Put in the timing things like walking to the block I dunno
        public IEnumerator EngageBlock(PushableBase block, Action doneAction)
        {
            _pushPoint = block;

            SoundManager.Instance.Stop(SoundManager.SoundEffect.Walk);
            //Get push direction for block (+/-X or +/-Z)
            //pushDirection = block.transform.forward;
            //Orient player toward block
            GetComponent<UserMovement>().RotateTo(block.GetOrientation());
            //Move player next to block
            transform.position = block.GetPosition().SetY(transform.position.y);

            pushDirection = GetComponent<UserMovement>().playerMesh.forward;

            //child block to player
            if (!block.GetPushBlock().IsSlippery)
            {
                transform.parent = block.transform.parent;
            }
            
            //Set input type to block pushing
            _blockEngaged = true;

            doneAction();
            yield return null;
        }