Ejemplo n.º 1
0
        private void StartBoostExecution()
        {
            Movement.GenericMovement boostMovement;
            switch ((PreviousSubPhase as BoostPlanningSubPhase).SelectedBoostHelper)
            {
            case "Straight 1":
                boostMovement = new Movement.StraightBoost(1, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.ManeuverColor.None);
                break;

            case "Bank 1 Left":
                boostMovement = new Movement.BankBoost(1, Movement.ManeuverDirection.Left, Movement.ManeuverBearing.Bank, Movement.ManeuverColor.None);
                break;

            case "Bank 1 Right":
                boostMovement = new Movement.BankBoost(1, Movement.ManeuverDirection.Right, Movement.ManeuverBearing.Bank, Movement.ManeuverColor.None);
                break;

            case "Turn 1 Right":
                boostMovement = new Movement.TurnBoost(1, Movement.ManeuverDirection.Right, Movement.ManeuverBearing.Turn, Movement.ManeuverColor.None);
                break;

            case "Turn 1 Left":
                boostMovement = new Movement.TurnBoost(1, Movement.ManeuverDirection.Left, Movement.ManeuverBearing.Turn, Movement.ManeuverColor.None);
                break;

            default:
                boostMovement = new Movement.StraightBoost(1, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.ManeuverColor.None);
                break;
            }

            MovementTemplates.ApplyMovementRuler(Selection.ThisShip, boostMovement);

            boostMovement.Perform();
            Sounds.PlayFly();
        }
Ejemplo n.º 2
0
        private void StartBoostExecution()
        {
            Rules.Collision.ClearBumps(TheShip);

            switch (SelectedBoostHelper)
            {
            case "Straight 1":
                BoostMovement = new StraightBoost(1, ManeuverDirection.Forward, ManeuverBearing.Straight, MovementComplexity.None);
                break;

            case "Bank 1 Left":
                BoostMovement = new BankBoost(1, ManeuverDirection.Left, ManeuverBearing.Bank, MovementComplexity.None);
                break;

            case "Bank 1 Right":
                BoostMovement = new BankBoost(1, ManeuverDirection.Right, ManeuverBearing.Bank, MovementComplexity.None);
                break;

            case "Turn 1 Right":
                BoostMovement = new TurnBoost(1, ManeuverDirection.Right, ManeuverBearing.Turn, MovementComplexity.None);
                break;

            case "Turn 1 Left":
                BoostMovement = new TurnBoost(1, ManeuverDirection.Left, ManeuverBearing.Turn, MovementComplexity.None);
                break;

            case "Straight 2":
                BoostMovement = new StraightBoost(2, ManeuverDirection.Forward, ManeuverBearing.Straight, MovementComplexity.None);
                break;

            case "Bank 2 Left":
                BoostMovement = new BankBoost(2, ManeuverDirection.Left, ManeuverBearing.Bank, MovementComplexity.None);
                break;

            case "Bank 2 Right":
                BoostMovement = new BankBoost(2, ManeuverDirection.Right, ManeuverBearing.Bank, MovementComplexity.None);
                break;

            case "Turn 2 Right":
                BoostMovement = new TurnBoost(2, ManeuverDirection.Right, ManeuverBearing.Turn, MovementComplexity.None);
                break;

            case "Turn 2 Left":
                BoostMovement = new TurnBoost(2, ManeuverDirection.Left, ManeuverBearing.Turn, MovementComplexity.None);
                break;

            default:
                BoostMovement = new StraightBoost(1, ManeuverDirection.Forward, ManeuverBearing.Straight, MovementComplexity.None);
                break;
            }

            BoostMovement.FinalPositionInfo = FinalPositionInfo;
            BoostMovement.TheShip           = TheShip;

            MovementTemplates.ApplyMovementRuler(TheShip, BoostMovement);

            GameManagerScript.Instance.StartCoroutine(BoostExecutionCoroutine());
        }
Ejemplo n.º 3
0
        private void StartBoostExecution()
        {
            Rules.Collision.ClearBumps(TheShip);

            Movement.GenericMovement boostMovement;
            switch (SelectedBoostHelper)
            {
            case "Straight 1":
                boostMovement = new Movement.StraightBoost(1, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.MovementComplexity.None);
                break;

            case "Bank 1 Left":
                boostMovement = new Movement.BankBoost(1, Movement.ManeuverDirection.Left, Movement.ManeuverBearing.Bank, Movement.MovementComplexity.None);
                break;

            case "Bank 1 Right":
                boostMovement = new Movement.BankBoost(1, Movement.ManeuverDirection.Right, Movement.ManeuverBearing.Bank, Movement.MovementComplexity.None);
                break;

            case "Turn 1 Right":
                boostMovement = new Movement.TurnBoost(1, Movement.ManeuverDirection.Right, Movement.ManeuverBearing.Turn, Movement.MovementComplexity.None);
                break;

            case "Turn 1 Left":
                boostMovement = new Movement.TurnBoost(1, Movement.ManeuverDirection.Left, Movement.ManeuverBearing.Turn, Movement.MovementComplexity.None);
                break;

            case "Straight 2":
                boostMovement = new Movement.StraightBoost(2, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.MovementComplexity.None);
                break;

            case "Bank 2 Left":
                boostMovement = new Movement.BankBoost(2, Movement.ManeuverDirection.Left, Movement.ManeuverBearing.Bank, Movement.MovementComplexity.None);
                break;

            case "Bank 2 Right":
                boostMovement = new Movement.BankBoost(2, Movement.ManeuverDirection.Right, Movement.ManeuverBearing.Bank, Movement.MovementComplexity.None);
                break;

            default:
                boostMovement = new Movement.StraightBoost(1, Movement.ManeuverDirection.Forward, Movement.ManeuverBearing.Straight, Movement.MovementComplexity.None);
                break;
            }

            boostMovement.TheShip = TheShip;

            MovementTemplates.ApplyMovementRuler(TheShip, boostMovement);

            boostMovement.Perform();
            if (!IsTractorBeamBoost)
            {
                Sounds.PlayFly(TheShip);
            }
        }
            private static void ShowFakeShip()
            {
                MovementTemplates.ApplyMovementRuler(Ship);

                FakeShip = GameObject.Instantiate <GameObject>(
                    Ship.Model,
                    MovementPrediction.FinalPositionInfo.Position,
                    new Quaternion()
                {
                    eulerAngles = MovementPrediction.FinalPositionInfo.Angles
                },
                    Ship.Model.transform.parent
                    );

                ShowFakeShipSemiTransparent();
            }
Ejemplo n.º 5
0
        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);
        }
Ejemplo n.º 6
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);
        }