Пример #1
0
    public static int GetRangeAndShow(GenericShip thisShip, GenericShip anotherShip)
    {
        ShipDistanceInformation distanceInfo = new ShipDistanceInformation(thisShip, anotherShip);

        MovementTemplates.ShowRangeRuler(distanceInfo);

        int range = distanceInfo.Range;

        if (range < 4)
        {
            Messages.ShowInfo("Range " + range);
        }
        else
        {
            Messages.ShowError("Out of range");
        }

        return(distanceInfo.Range);
    }
Пример #2
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 static void PlaceObstacle(string obstacleName, Vector3 position, Vector3 angles)
        {
            Phases.CurrentSubPhase.IsReadyForCommands = false;

            ChosenObstacle.ObstacleGO.transform.position    = position;
            ChosenObstacle.ObstacleGO.transform.eulerAngles = angles;

            ChosenObstacle.ObstacleGO.transform.parent = Board.BoardTransform;

            ChosenObstacle.IsPlaced = true;
            ChosenObstacle          = null;
            IsEnteredPlacementZone  = false;
            IsEnteredPlaymat        = false;

            MovementTemplates.ReturnRangeRulerR1();
            MovementTemplates.ReturnRangeRulerR2();

            FinishSubPhase();
        }
Пример #4
0
        private void StartBoostExecution()
        {
            Rules.Collision.ClearBumps(TheShip);

            Movement.GenericMovement boostMovement;
            switch ((PreviousSubPhase as BoostPlanningSubPhase).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;

            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);
            }
        }
Пример #5
0
        public void StartDecloakPlanning()
        {
            GameObject prefab = (GameObject)Resources.Load(Selection.ThisShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));

            ShipStand = MonoBehaviour.Instantiate(prefab, Selection.ThisShip.GetPosition(), Selection.ThisShip.GetRotation(), BoardTools.Board.GetBoard());
            ShipStand.transform.Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material = Selection.ThisShip.Model.transform.Find("RotationHelper").Find("RotationHelper2").Find("ShipAllParts").Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material;
            ShipStand.transform.Find("ShipBase").Find("ObstaclesStayDetector").gameObject.AddComponent <ObstaclesStayDetectorForced>();
            obstaclesStayDetectorBase = ShipStand.GetComponentInChildren <ObstaclesStayDetectorForced>();

            MovementTemplates.CurrentTemplate          = MovementTemplates.GetMovement2Ruler();
            MovementTemplates.CurrentTemplate.position = Selection.ThisShip.TransformPoint(new Vector3(0.5f, 0, -0.25f));

            foreach (Transform decloakHelper in Selection.ThisShip.GetDecloakHelper())
            {
                AvailableDecloakDirections.Add(decloakHelper.name, decloakHelper.Find("Finisher").position);
            }

            Roster.SetRaycastTargets(false);
            TurnOnDragging();
        }
Пример #6
0
        private void HanSoloSetupRangeHelper()
        {
            List <DistanceInfo> distancesToShips = new List <DistanceInfo>();

            foreach (GenericShip placedEnemyShip in HostShip.Owner.AnotherPlayer.Ships.Values.Where(n => n.IsSetupPerformed))
            {
                distancesToShips.Add(new DistanceInfo(HostShip, placedEnemyShip));
            }

            MovementTemplates.ReturnRangeRuler();

            if (distancesToShips.Count > 0)
            {
                DistanceInfo minDistance = distancesToShips.OrderBy(n => n.MinDistance.DistanceReal).First();
                if (minDistance.Range <= 3)
                {
                    MovementTemplates.ShowRangeRuler(minDistance.MinDistance);
                }
            }
        }
Пример #7
0
    // CHECK LEGALITY OF ATTACK

    public static void TryPerformAttack()
    {
        UI.HideContextMenu();
        MovementTemplates.ReturnRangeRuler();

        if (IsTargetLegalForAttack())
        {
            UI.HideSkipButton();
            Roster.AllShipsHighlightOff();

            DeclareAttackerAndDefender();

            CheckFireLineCollisions();
        }
        else
        {
            IsAttackAlreadyCalled = false;
            Roster.GetPlayer(Phases.CurrentPhasePlayer).OnTargetNotLegalForAttack();
        }
    }
Пример #8
0
        public void UpdateRotation()
        {
            float turningDirection = 0;

            if (Direction == ManeuverDirection.Right)
            {
                turningDirection = 1;
            }
            if (Direction == ManeuverDirection.Left)
            {
                turningDirection = -1;
            }

            Vector3 point_ShipStandBack  = Selection.ThisShip.GetCentralBackPoint();
            Vector3 point_ShipStandFront = Selection.ThisShip.GetCentralFrontPoint();
            float   pathToProcessLeft    = (MovementTemplates.CurrentTemplate.transform.InverseTransformPoint(point_ShipStandBack).x);

            if (pathToProcessLeft > 0)
            {
                float   distance_ShipStandFront_RulerStart  = Vector3.Distance(MovementTemplates.CurrentTemplate.transform.position, point_ShipStandFront);
                float   length_ShipStandFront_ShipStandBack = GetMovement1();
                Vector3 vector_RulerStart_ShipStandFront    = MovementTemplates.CurrentTemplate.transform.InverseTransformPoint(point_ShipStandFront);
                Vector3 vector_RulerStart_RulerBack         = Vector3.right; // Strange magic due to ruler's rotation

                float angle_ToShipFront_ToRulerBack = Vector3.Angle(vector_RulerStart_ShipStandFront, vector_RulerStart_RulerBack);

                float sinSecondAngle = (distance_ShipStandFront_RulerStart / length_ShipStandFront_ShipStandBack) * Mathf.Sin(angle_ToShipFront_ToRulerBack * Mathf.Deg2Rad);
                float secondAngle    = Mathf.Asin(sinSecondAngle) * Mathf.Rad2Deg;

                float angle_ToShipFront_CorrectStandPosition = -(180 - secondAngle - angle_ToShipFront_ToRulerBack);
                float rotationFix = angle_ToShipFront_CorrectStandPosition * turningDirection;
                Selection.ThisShip.SetRotationHelper2Angles(new Vector3(0, rotationFix, 0));

                Vector3 standOrientationVector = MovementTemplates.CurrentTemplate.transform.InverseTransformPoint(Selection.ThisShip.GetCentralFrontPoint()) - MovementTemplates.CurrentTemplate.transform.InverseTransformPoint(Selection.ThisShip.GetCentralBackPoint());
                float   angleBetweenMinus      = -Vector3.Angle(vector_RulerStart_ShipStandFront, standOrientationVector);
                float   angleFix = angleBetweenMinus * turningDirection;
                Selection.ThisShip.UpdateRotationHelperAngles(new Vector3(0, angleFix, 0));
            }

            MovementTemplates.AddRulerCenterPoint(point_ShipStandFront);
        }
Пример #9
0
        private void SelectLandoCalrissianPilotAbilityTarget()
        {
            Selection.ThisShip = TargetShip;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Lando Calrissian's ability: Free action",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnFreeActionPlanned,
                EventHandler = PerformFreeAction
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnFreeActionPlanned, delegate {
                Phases.FinishSubPhase(typeof(SelectLandoCalrissianPilotAbilityTargetSubPhase));
                Triggers.FinishTrigger();
            });
        }
Пример #10
0
        private void SelectColonelJendonAbilityTarget()
        {
            if (TargetShip.Tokens.HasToken(typeof(Tokens.BlueTargetLockToken), '*'))
            {
                Messages.ShowErrorToHuman("Only ships without blue target lock tokens can be selected");
                return;
            }

            MovementTemplates.ReturnRangeRuler();

            var token = HostShip.Tokens.GetToken(typeof(Tokens.BlueTargetLockToken), '*') as Tokens.BlueTargetLockToken;

            Actions.ReassignTargetLockToken(
                token.Letter,
                this.HostShip,
                TargetShip,
                delegate {
                Phases.FinishSubPhase(Phases.CurrentSubPhase.GetType());
                DecisionSubPhase.ConfirmDecision();
            });
        }
Пример #11
0
    // CHECK LEGALITY OF ATTACK

    public static void TryPerformAttack(bool isSilent)
    {
        UI.HideContextMenu();

        MovementTemplates.ReturnRangeRuler();

        if (ChosenWeapon != null && Rules.TargetIsLegalForShot.IsLegal(Selection.ThisShip, Selection.AnotherShip, ChosenWeapon, isSilent))
        {
            UI.HideSkipButton();
            Roster.AllShipsHighlightOff();

            SetArcAsUsedForAttack();
            DeclareAttackerAndDefender();
            CheckFireLineCollisions();
        }
        else
        {
            IsAttackAlreadyCalled = false;
            Roster.GetPlayer(Phases.CurrentPhasePlayer).OnTargetNotLegalForAttack();
        }
    }
Пример #12
0
        public void StartBarrelRollPlanning()
        {
            GameObject prefab = (GameObject)Resources.Load(Selection.ThisShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));

            ShipStand = MonoBehaviour.Instantiate(prefab, Selection.ThisShip.GetPosition(), Selection.ThisShip.GetRotation(), BoardManager.GetBoard());
            ShipStand.transform.Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material = Selection.ThisShip.Model.transform.Find("RotationHelper").Find("RotationHelper2").Find("ShipAllParts").Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material;
            ShipStand.transform.Find("ShipBase").Find("ObstaclesStayDetector").gameObject.AddComponent <ObstaclesStayDetectorForced>();
            obstaclesStayDetectorBase = ShipStand.GetComponentInChildren <ObstaclesStayDetectorForced>();

            barrelRollDistance            = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 2f : 2.5f;
            barrelRollTemplateDistance    = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.5f : 1.25f;
            battelRollTemplateLimitTop    = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.25f : 1f;
            battelRollTemplateLimitBottom = (Selection.ThisShip.ShipBaseSize == Ship.BaseSize.Small) ? 0.75f : 2f;

            MovementTemplates.CurrentTemplate          = MovementTemplates.GetMovement1Ruler();
            MovementTemplates.CurrentTemplate.position = Selection.ThisShip.TransformPoint(new Vector3(barrelRollTemplateDistance, 0, -battelRollTemplateLimitTop));
            obstaclesStayDetectorMovementTemplate      = MovementTemplates.CurrentTemplate.GetComponentInChildren <ObstaclesStayDetectorForced>();

            Roster.SetRaycastTargets(false);
            inReposition = true;
        }
Пример #13
0
        private void PerformCoordinateEffect()
        {
            Selection.ThisShip = TargetShip;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Coordinate",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnFreeActionPlanned,
                EventHandler = PerformFreeAction
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnFreeActionPlanned, delegate {
                Phases.FinishSubPhase(typeof(CoordinateTargetSubPhase));
                CallBack();
            });
        }
Пример #14
0
        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);
        }
Пример #15
0
    public static void TryPerformAttack()
    {
        Game.UI.HideContextMenu();
        MovementTemplates.ReturnRangeRuler();

        if (Rules.TargetIsLegalForShot.IsLegal() && ChosenWeapon.IsShotAvailable(Selection.AnotherShip))
        {
            Game.UI.HideSkipButton();
            ShotInfo = (ChosenWeapon.GetType() == typeof(Ship.PrimaryWeaponClass)) ? ShotInfo : new ShipShotDistanceInformation(Selection.ThisShip, Selection.AnotherShip, ChosenWeapon);
            ShotInfo.CheckFirelineCollisions(delegate { PerformAttack(Selection.ThisShip, Selection.AnotherShip); });
        }
        else
        {
            if (Roster.GetPlayer(Phases.CurrentPhasePlayer).GetType() == typeof(Players.HumanPlayer))
            {
                // TODO: Better explanations
                if (!Rules.TargetIsLegalForShot.IsLegal())
                {
                    Messages.ShowError("Attack is not legal (this ship cannot attack or target cannot be attacked)");
                }
                else if (!ShotInfo.InShotAngle)
                {
                    Messages.ShowError("Target is outside your firing arc");
                }
                else if (ShotInfo.Distance > ChosenWeapon.MaxRange || ShotInfo.Distance < ChosenWeapon.MinRange)
                {
                    Messages.ShowError("Target is outside your firing range");
                }

                //TODO: except non-legal targets, bupmed for example, biggs?
                Roster.HighlightShipsFiltered(Roster.AnotherPlayer(Phases.CurrentPhasePlayer));
                Game.UI.HighlightNextButton();
            }
            else
            {
                Selection.ThisShip.IsAttackPerformed = true;
                Phases.FinishSubPhase(typeof(SubPhases.CombatSubPhase));
            }
        }
    }
        private void ApplyEdgeLimits()
        {
            MovementTemplates.ReturnRangeRulerR2();

            Vector3 fromEdge    = Vector3.zero;
            Vector3 toObstacle  = Vector3.zero;
            float   minDistance = float.MaxValue;

            bool IsShiftRequired = false;

            foreach (BoxCollider collider in Board.BoardTransform.Find("OffTheBoardHolder").GetComponentsInChildren <BoxCollider>())
            {
                Vector3 closestPoint = collider.ClosestPoint(ChosenObstacle.ObstacleGO.transform.position);

                RaycastHit hitInfo = new RaycastHit();

                if (Physics.Raycast(closestPoint + new Vector3(0, 0.003f, 0), ChosenObstacle.ObstacleGO.transform.position - closestPoint, out hitInfo))
                {
                    float distanceFromEdge = Vector3.Distance(closestPoint, hitInfo.point);
                    if (distanceFromEdge < MinBoardEdgeDistance)
                    {
                        IsShiftRequired = true;

                        if (distanceFromEdge < minDistance)
                        {
                            fromEdge    = closestPoint;
                            toObstacle  = hitInfo.point;
                            minDistance = distanceFromEdge;
                        }

                        MoveObstacleToKeepInPlacementZone(closestPoint, hitInfo.point);
                    }
                }
            }

            if (IsShiftRequired)
            {
                MovementTemplates.ShowRangeRulerR2(fromEdge, toObstacle);
            }
        }
Пример #17
0
        private void PerformJamEffect()
        {
            var jammingShip = Selection.ThisShip;
            var targetShip  = TargetShip;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Jam",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnTokenIsAssigned,
                EventHandler = (s, e) => AssignJamToken(targetShip)
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnTokenIsAssigned, delegate {
                Selection.ThisShip = jammingShip;
                Phases.FinishSubPhase(typeof(JamTargetSubPhase));
                CallBack();
            });
        }
Пример #18
0
        public override bool AnotherShipCanBeSelected(Ship.GenericShip targetShip)
        {
            bool result = false;

            if (Selection.ThisShip != null)
            {
                if (targetShip.Owner.PlayerNo != Phases.CurrentSubPhase.RequiredPlayer)
                {
                    Board.ShipShotDistanceInformation shotInfo = new Board.ShipShotDistanceInformation(Selection.ThisShip, targetShip);
                    MovementTemplates.ShowFiringArcRange(shotInfo);
                    result = true;
                }
                else
                {
                    Messages.ShowErrorToHuman("Ship cannot be selected as attack target: Friendly ship");
                }
            }
            else
            {
                Messages.ShowErrorToHuman("Ship cannot be selected as attack target:\nFirst select attacker");
            }
            return(result);
        }
Пример #19
0
        public override void Next()
        {
            if (DebugManager.DebugPhases)
            {
                Debug.Log("Combat SubPhase - Next");
            }

            UI.HideSkipButton();
            MovementTemplates.ReturnRangeRuler();
            Selection.DeselectAllShips();

            // Try to get any pilot with same inititative, that didn't perform attack
            bool success = GetNextActivation(RequiredInitiative);

            if (success)
            {
                ReadyForCombatActivation();
            }
            else
            {
                ChangeInitiative();
            }
        }
Пример #20
0
        private void SelectSquadLeaderTarget()
        {
            Selection.ThisShip = TargetShip;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Squad Leader: Free action",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnFreeActionPlanned,
                EventHandler = PerformFreeAction
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnFreeActionPlanned, delegate {
                Phases.FinishSubPhase(typeof(SelectSquadLeaderTargetSubPhase));
                Phases.FinishSubPhase(typeof(ActionDecisonSubPhase));
                Triggers.FinishTrigger();
                CallBack();
            });
        }
Пример #21
0
        public static void SelectShip(int shipId)
        {
            GenericShip ship = Roster.GetShipById("ShipId:" + shipId);

            (Phases.CurrentSubPhase as SelectShipSubPhase).IsReadyForCommands = false;

            (Phases.CurrentSubPhase as SelectShipSubPhase).TargetShip = ship;

            UI.HideNextButton();
            if (ship != Selection.ThisShip)
            {
                MovementTemplates.ShowRange(Selection.ThisShip, ship);
            }

            if (!Network.IsNetworkGame)
            {
                (Phases.CurrentSubPhase as SelectShipSubPhase).InvokeFinish();
            }
            else
            {
                Network.SelectTargetShip(ship.ShipId);
            }
        }
Пример #22
0
        private void PerformMultiCoordinateEffect(GenericShip targetShip)
        {
            Selection.ChangeActiveShip(targetShip);
            GenericAction currentAction = ActionsHolder.CurrentAction;

            Triggers.RegisterTrigger(
                new Trigger()
            {
                Name         = "Coordinate",
                TriggerOwner = Selection.ThisShip.Owner.PlayerNo,
                TriggerType  = TriggerTypes.OnFreeActionPlanned,
                EventHandler = delegate { PerformFreeAction(targetShip); }
            }
                );

            MovementTemplates.ReturnRangeRuler();

            Triggers.ResolveTriggers(TriggerTypes.OnFreeActionPlanned, (System.Action) delegate {
                Selection.ChangeActiveShip(CoordinateActionData.CoordinateProvider);
                CoordinateActionData.CoordinateProvider.OnCoordinateTargetIsSelected -= PrepareToRememberChosenAction;
                ActionsHolder.CurrentAction = currentAction;
                Triggers.FinishTrigger();
            });
        }
Пример #23
0
    // CHECK LEGALITY OF ATTACK

    public static void TryPerformAttack(bool isSilent)
    {
        UI.HideContextMenu();

        MovementTemplates.ReturnRangeRuler();

        if (ChosenWeapon != null && Rules.TargetIsLegalForShot.IsLegal(Selection.ThisShip, Selection.AnotherShip, ChosenWeapon, isSilent))
        {
            if (!DebugManager.NoCinematicCamera)
            {
                CommandsList.ShotCamera.ShowShotCamera(Selection.ThisShip, Selection.AnotherShip);
                GameManagerScript.Wait(3, StartLegalAttack);
            }
            else
            {
                StartLegalAttack();
            }
        }
        else
        {
            IsAttackAlreadyCalled = false;
            Roster.GetPlayer(Phases.CurrentPhasePlayer).OnTargetNotLegalForAttack();
        }
    }
Пример #24
0
    public static void TryPerformAttack()
    {
        Game.UI.HideContextMenu();
        MovementTemplates.ReturnRangeRuler();

        if (Rules.TargetIsLegalForShot.IsLegal())
        {
            ShipShotDistanceInformation shotInfo = new ShipShotDistanceInformation(Selection.ThisShip, Selection.AnotherShip);
            shotInfo.CheckFirelineCollisions(CallPerformAttack);
        }
        else
        {
            if (Roster.GetPlayer(Phases.CurrentPhasePlayer).GetType() == typeof(Players.HumanPlayer))
            {
                Roster.HighlightShipsFiltered(Roster.AnotherPlayer(Phases.CurrentPhasePlayer));
                Game.UI.HighlightNextButton();
            }
            else
            {
                Selection.ThisShip.IsAttackPerformed = true;
                Phases.FinishSubPhase(typeof(SubPhases.CombatSubPhase));
            }
        }
    }
Пример #25
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);
        }
Пример #26
0
        private void SelectGarvenDreisAbilityTarget()
        {
            MovementTemplates.ReturnRangeRuler();

            TargetShip.Tokens.AssignToken(typeof(FocusToken), SelectShipSubPhase.FinishSelection);
        }
Пример #27
0
        private void FinishManeuverExecution()
        {
            MovementTemplates.HideLastMovementRuler();

            Selection.ActiveShip.CallExecuteMoving(GameMode.CurrentGameMode.FinishMovementExecution);
        }
Пример #28
0
 //TODO: What is this?
 public virtual void CallNextSubPhase()
 {
     UI.HideTemporaryMenus();
     MovementTemplates.ReturnRangeRuler();
     Next();
 }
Пример #29
0
        private void FinishManeuverExecution()
        {
            MovementTemplates.HideLastMovementRuler();

            Selection.ActiveShip.CallExecuteMoving(Triggers.FinishTrigger);
        }
Пример #30
0
        private static void AddMovementTemplateCenterPoint(GameObject shipBase)
        {
            Vector3 point_ShipStandFront = shipBase.transform.TransformPoint(Vector3.zero);

            MovementTemplates.AddRulerCenterPoint(point_ShipStandFront);
        }