Пример #1
0
        void Update()
        {
            var shouldPush     = Input.GetButtonDown(playerMovement.TertiaryInput);
            var cooldownIsOver = Time.fixedTime - lastPushedTime > CooldownSeconds;

            if (shouldPush && cooldownIsOver && !blockHolder.IsHoldingBlock())
            {
                lastPushedTime = Time.fixedTime;
                Push();
            }
        }
Пример #2
0
        private void TryMounting()
        {
            if (canMount && !blockHolder.IsHoldingBlock() && Input.GetButtonDown(playerMovement.SecondaryInput))
            {
                foreach (var block in ship.GetBlocks())
                {
                    block.SetSelected(false);
                }

                HidePlayer();
                GainShipControl();
                mounting = true;
            }
        }
Пример #3
0
        void Update()
        {
            if (targetBlock != null)
            {
                var objectIsDeactivated = !targetBlock.gameObject.activeSelf;
                if (objectIsDeactivated || targetBlock.transform.position.y > 5 ||
                    targetBlock.transform.position.y < -10)
                {
                    targetBlock = null;
                }
            }

            if (ship.HasBombAttached())
            {
                if (blockHolder.IsHoldingBlock())
                {
                    blockHolder.ReleaseHoldingBlock();
                }

                //TODO This is treating the symptops of another unknown bug
                var destroyedBlocks = new List <Block>();
                foreach (var block in ship.GetBlocks())
                {
                    if (block == null)
                    {
                        destroyedBlocks.Add(block); //GameObject overloads "==", it is not null only "Destroyed".
                    }
                    else if (block.GetComponent <Explodable>())
                    {
                        targetBlock = block;
                        state       = State.RemovingBomb;
                    }
                }

                foreach (var destroyedBlock in destroyedBlocks)
                {
                    ship.ForceRemoveBlock(destroyedBlock);
                }
            }


            if (state == State.Thinking)
            {
                Thinking();
            }
            else if (state == State.SearchingForBlock)
            {
                SearchingForBlock();
            }
            else if (state == State.GettingBlock || state == State.RemovingBomb)
            {
                GettingBlock();
            }
            else if (state == State.AttachingBlock)
            {
                AttachingBlock();
            }
            else if (state == State.PlacingBomb)
            {
                PlacingBomb();
            }
            else if (state == State.Pillaging)
            {
                Pillaging();
            }

            TeleportAwayIfStuck();
            ThinkAboutAbandoningPipeDream();
        }