Beispiel #1
0
        private void CancelBarrelRoll()
        {
            Selection.ThisShip.IsLandedOnObstacle = false;
            inReposition = false;
            MonoBehaviour.Destroy(ShipStand);
            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            PreviousSubPhase.Resume();
        }
Beispiel #2
0
        protected virtual void FinishMovementEvents()
        {
            MovementTemplates.HideLastMovementRuler();

            Selection.ThisShip.CallExecuteMoving();

            //Called as callbacks
            //Selection.ThisShip.FinishMovement();
            //Selection.ThisShip.FinishPosition();
            //Phases.FinishSubPhase(typeof(SubPhases.MovementExecutionSubPhase));
        }
Beispiel #3
0
        protected override void FinishMovement()
        {
            //TEMP
            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.FuncsToUpdate.Remove(UpdateBoost);

            MovementTemplates.HideLastMovementRuler();
            TheShip.ResetRotationHelpers();

            (Phases.CurrentSubPhase as SubPhases.BoostExecutionSubPhase).FinishBoost();
        }
Beispiel #4
0
        protected override void FinishMovement()
        {
            //TEMP
            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.FuncsToUpdate.Remove(UpdateBoost);

            MovementTemplates.HideLastMovementRuler();
            Selection.ThisShip.ResetRotationHelpers();

            Phases.FinishSubPhase(typeof(SubPhases.BoostExecutionSubPhase));
        }
Beispiel #5
0
        public void CancelBoost()
        {
            Selection.ThisShip.IsLandedOnObstacle = false;
            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            PreviousSubPhase.Resume();
        }
Beispiel #6
0
        private void CancelDecloak()
        {
            Selection.ThisShip.RemoveAlreadyExecutedAction(typeof(ActionsList.CloakAction));
            Selection.ThisShip.IsLandedOnObstacle = false;
            inReposition = false;
            MonoBehaviour.Destroy(ShipStand);
            Game.Movement.CollidedWith = null;

            MovementTemplates.HideLastMovementRuler();
            MovementTemplates.CurrentTemplate.gameObject.SetActive(true);

            PreviousSubPhase.Resume();
        }
Beispiel #7
0
        public void CancelBoost(List <ActionFailReason> boostProblems)
        {
            TheShip.IsLandedOnObstacle = false;

            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            Rules.Actions.ActionIsFailed(TheShip, HostAction, boostProblems);
        }
Beispiel #8
0
        public void CancelBoost()
        {
            TheShip.IsLandedOnObstacle = false;

            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            RuleSet.Instance.ActionIsFailed(TheShip, typeof(ActionsList.BoostAction));
        }
Beispiel #9
0
        public void CancelBoost()
        {
            TheShip.IsLandedOnObstacle = false;

            TheShip.RemoveAlreadyExecutedAction(typeof(ActionsList.BoostAction));
            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            PreviousSubPhase.Resume();
        }
Beispiel #10
0
        private void CancelBarrelRoll()
        {
            Selection.ThisShip.RemoveAlreadyExecutedAction(typeof(ActionsList.BarrelRollAction));
            Selection.ThisShip.IsLandedOnObstacle = false;
            inReposition = false;
            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;
            MovementTemplates.HideLastMovementRuler();

            PreviousSubPhase.Resume();
        }
Beispiel #11
0
        protected override void FinishMovement()
        {
            //TEMP
            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.FuncsToUpdate.Remove(UpdateBoost);

            MovementTemplates.HideLastMovementRuler();
            TheShip.ResetRotationHelpers();

            // Important! Fixes final position according to prediction - otherwise animation can cause another final position
            TheShip.SetPositionInfo(FinalPositionInfo);

            (Phases.CurrentSubPhase as SubPhases.BoostExecutionSubPhase).FinishBoost();
        }
Beispiel #12
0
        private void FinishBarrelRollAnimation()
        {
            performingAnimation = false;

            MonoBehaviour.Destroy(ShipStand);
            Game.Movement.CollidedWith = null;

            MovementTemplates.HideLastMovementRuler();
            MovementTemplates.CurrentTemplate.gameObject.SetActive(true);

            Selection.ThisShip.ToggleShipStandAndPeg(true);
            Selection.ThisShip.FinishPosition(delegate() { });

            Phases.FinishSubPhase(typeof(BarrelRollExecutionSubPhase));
            callBack();
        }
Beispiel #13
0
        private void FinishBarrelRollAnimation()
        {
            performingAnimation = false;

            MonoBehaviour.Destroy(ShipStand);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;

            MovementTemplates.HideLastMovementRuler();
            MovementTemplates.CurrentTemplate.gameObject.SetActive(true);

            Selection.ThisShip.ToggleShipStandAndPeg(true);
            Selection.ThisShip.FinishPosition(FinishBarrelRollAnimationPart2);
        }
Beispiel #14
0
        public void FinishBarrelRollAnimation()
        {
            performingAnimation = false;

            TheShip.ApplyRotationHelpers();
            TheShip.ResetRotationHelpers();
            TheShip.SetAngles(TemporaryShipBase.transform.eulerAngles);

            MonoBehaviour.DestroyImmediate(TemporaryShipBase);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;

            MovementTemplates.HideLastMovementRuler();

            TheShip.ToggleShipStandAndPeg(true);
            TheShip.FinishPosition(FinishBarrelRollAnimationPart2);
        }
        public override GameObject[] PlanFinalPosition()
        {
            //Temporary
            MovementTemplates.ApplyMovementRuler(TheShip);

            GameObject[] result = new GameObject[1];

            float   distance = ProgressTarget;
            Vector3 position = TheShip.GetPosition();

            GameObject prefab    = (GameObject)Resources.Load(TheShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));
            GameObject ShipStand = MonoBehaviour.Instantiate(prefab, position, TheShip.GetRotation(), BoardTools.Board.GetBoard());

            Renderer[] renderers = ShipStand.GetComponentsInChildren <Renderer>();
            if (!DebugManager.DebugMovementShowTempBases)
            {
                foreach (var render in renderers)
                {
                    render.enabled = false;
                }
            }

            float turningDirection = (Direction == ManeuverDirection.Right) ? 1 : -1;

            ShipStand.transform.RotateAround(TheShip.TransformPoint(new Vector3(turningAroundDistance * turningDirection, 0, 0)), new Vector3(0, 1, 0), turningDirection * distance);

            UpdatePlanningRotation(ShipStand);

            position = ShipStand.transform.position;
            distance = TheShip.ShipBase.GetShipBaseDistance();

            ShipStand.transform.position = Vector3.MoveTowards(position, position + ShipStand.transform.TransformDirection(Vector3.forward), distance);

            UpdatePlanningRotationFinisher(ShipStand);

            result[0] = ShipStand;

            ShipStand.name = "Finishing";

            MovementTemplates.HideLastMovementRuler();

            return(result);
        }
        public void FinishDecloakAnimation()
        {
            performingAnimation = false;

            TheShip.ApplyRotationHelpers();
            TheShip.ResetRotationHelpers();
            TheShip.SetAngles(TemporaryShipBase.transform.eulerAngles);
            TheShip.Model.transform.localPosition = new Vector3(TheShip.Model.transform.localPosition.x, 0, TheShip.Model.transform.localPosition.z);

            MonoBehaviour.Destroy(TemporaryShipBase);

            GameManagerScript Game = GameObject.Find("GameManager").GetComponent <GameManagerScript>();

            Game.Movement.CollidedWith = null;

            MovementTemplates.HideLastMovementRuler();
            MovementTemplates.CurrentTemplate.gameObject.SetActive(true);

            Selection.ThisShip.ToggleShipStandAndPeg(true);
            Selection.ThisShip.FinishPosition(FinishDecloakAnimationPart2);
        }
Beispiel #17
0
        // PLANNING

        public override GameObject[] PlanMovement()
        {
            //Temporary
            MovementTemplates.ApplyMovementRuler(Selection.ThisShip);

            GameObject[] result = new GameObject[101];

            float   distancePart = ProgressTarget / 80;
            Vector3 position     = Selection.ThisShip.GetPosition();

            GameObject lastShipStand = null;

            for (int i = 0; i <= 80; i++)
            {
                float      step      = (float)i * distancePart;
                GameObject prefab    = (GameObject)Resources.Load(Selection.ThisShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));
                GameObject ShipStand = MonoBehaviour.Instantiate(prefab, position, Selection.ThisShip.GetRotation(), Board.BoardManager.GetBoard());

                Renderer[] renderers = ShipStand.GetComponentsInChildren <Renderer>();
                if (!DebugManager.DebugMovement)
                {
                    foreach (var render in renderers)
                    {
                        render.enabled = false;
                    }
                }

                if (i > 0)
                {
                    float turningDirection = (Direction == ManeuverDirection.Right) ? 1 : -1;
                    ShipStand.transform.RotateAround(Selection.ThisShip.TransformPoint(new Vector3(turningAroundDistance * turningDirection, 0, 0)), new Vector3(0, 1, 0), turningDirection * step);

                    UpdatePlanningRotation(ShipStand);

                    if (i == 80)
                    {
                        lastShipStand = ShipStand;
                    }
                }

                result[i] = ShipStand;

                ShipStand.name = "Main" + i;
            }

            GameObject savedShipStand = MonoBehaviour.Instantiate(lastShipStand);

            savedShipStand.transform.localEulerAngles -= new Vector3(0f, lastPlanningRotation, 0f);

            position     = lastShipStand.transform.position;
            distancePart = Selection.ThisShip.ShipBase.GetShipBaseDistance() / 20;
            for (int i = 1; i <= 20; i++)
            {
                position = Vector3.MoveTowards(position, position + savedShipStand.transform.TransformDirection(Vector3.forward), distancePart);
                GameObject prefab    = (GameObject)Resources.Load(Selection.ThisShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));
                GameObject ShipStand = MonoBehaviour.Instantiate(prefab, position, savedShipStand.transform.rotation, Board.BoardManager.GetBoard());

                Renderer[] renderers = ShipStand.GetComponentsInChildren <Renderer>();
                if (!DebugManager.DebugMovement)
                {
                    foreach (var render in renderers)
                    {
                        render.enabled = false;
                    }
                }

                UpdatePlanningRotationFinisher(ShipStand);

                result[i + 80] = ShipStand;

                ShipStand.name = "Finishing" + i;
            }

            MonoBehaviour.Destroy(savedShipStand);

            MovementTemplates.HideLastMovementRuler();

            return(result);
        }
Beispiel #18
0
        private void FinishManeuverExecution()
        {
            MovementTemplates.HideLastMovementRuler();

            GameMode.CurrentGameMode.FinishMovementExecution();
        }
Beispiel #19
0
        private void FinishManeuverExecution()
        {
            MovementTemplates.HideLastMovementRuler();

            Selection.ActiveShip.CallExecuteMoving(Triggers.FinishTrigger);
        }
 private static void Finish()
 {
     GameObject.Destroy(FakeShip);
     MovementTemplates.HideLastMovementRuler();
     GenericSubPhase.HideSubphaseDescription();
 }
Beispiel #21
0
        private void FinishManeuverExecution()
        {
            MovementTemplates.HideLastMovementRuler();

            Selection.ActiveShip.CallExecuteMoving(GameMode.CurrentGameMode.FinishMovementExecution);
        }