예제 #1
0
        private void DropSparePartsToken()
        {
            Action Callback = Phases.CurrentSubPhase.CallBack;

            DecisionSubPhase.ConfirmDecisionNoCallback();

            HostUpgrade.State.SpendCharge();

            ManeuverTemplate dropTemplate = new ManeuverTemplate(ManeuverBearing.Straight, ManeuverDirection.Forward, ManeuverSpeed.Speed1, isBombTemplate: true);

            dropTemplate.ApplyTemplate(HostShip, HostShip.GetBack(), Direction.Bottom);

            Debris spareParts = new Debris("Spare Parts", "spareparts");

            spareParts.Spawn("Spare Parts " + HostShip.ShipId, Board.GetBoard());
            ObstaclesManager.AddObstacle(spareParts);

            spareParts.ObstacleGO.transform.position    = dropTemplate.GetFinalPosition();
            spareParts.ObstacleGO.transform.eulerAngles = dropTemplate.GetFinalAngles();
            spareParts.IsPlaced = true;

            GameManagerScript.Wait(
                1,
                delegate
            {
                Messages.ShowInfo("Spare Parts are dropped");
                dropTemplate.DestroyTemplate();
                BreakAllLocksRecursive(Callback);
            }
                );
        }
예제 #2
0
        private void DropCargoToken()
        {
            Action Callback = Phases.CurrentSubPhase.CallBack;

            DecisionSubPhase.ConfirmDecisionNoCallback();

            HostUpgrade.State.SpendCharge();

            ManeuverTemplate dropTemplate = new ManeuverTemplate(ManeuverBearing.Straight, ManeuverDirection.Forward, ManeuverSpeed.Speed1, isBombTemplate: true);

            dropTemplate.ApplyTemplate(HostShip, HostShip.GetBack(), Direction.Bottom);

            Debris looseCargo = new Debris("Loose Cargo", "loosecargo");

            looseCargo.Spawn("Loose Cargo " + HostShip.ShipId, Board.GetBoard());
            ObstaclesManager.AddObstacle(looseCargo);

            looseCargo.ObstacleGO.transform.position    = dropTemplate.GetFinalPosition();
            looseCargo.ObstacleGO.transform.eulerAngles = dropTemplate.GetFinalAngles();
            looseCargo.IsPlaced = true;

            GameManagerScript.Wait(
                1,
                delegate
            {
                dropTemplate.DestroyTemplate();
                Callback();
            }
                );
        }
예제 #3
0
        private void ShowBombAndLaunchTemplate(ManeuverTemplate bombDropTemplate)
        {
            bombDropTemplate.ApplyTemplate(Selection.ThisShip, Selection.ThisShip.GetPosition(), Direction.Top);

            Vector3    bombPosition = bombDropTemplate.GetFinalPosition();
            Quaternion bombRotation = bombDropTemplate.GetFinalRotation();

            CreateBombObject(bombPosition, bombRotation);
            BombObjects[0].transform.position = bombPosition;

            SelectedBombLaunchHelper = bombDropTemplate;
        }
예제 #4
0
        private void ShowBombAndDropTemplate(ManeuverTemplate bombDropTemplate)
        {
            GenericBomb bomb = BombsManager.CurrentDevice as GenericBomb;

            bombDropTemplate.ApplyTemplate(Selection.ThisShip, Selection.ThisShip.GetBack(), Direction.Bottom);

            Vector3    bombPosition = bombDropTemplate.GetFinalPosition();
            Quaternion bombRotation = bombDropTemplate.GetFinalRotation();

            CreateBombObject(bombPosition, bombRotation);

            for (int i = 0; i < BombObjects.Count; i++)
            {
                switch (i)
                {
                case 0:
                    BombObjects[i].transform.position = bombPosition;
                    break;

                case 1:
                    BombObjects[i].transform.position = bombPosition
                                                        + BombObjects.First().transform.TransformVector(new Vector3(
                                                                                                            bomb.bombSideDistanceX,
                                                                                                            0,
                                                                                                            bomb.bombSideDistanceZ
                                                                                                            )
                                                                                                        );
                    break;

                case 2:
                    BombObjects[i].transform.position = bombPosition
                                                        + BombObjects.First().transform.TransformVector(new Vector3(
                                                                                                            -bomb.bombSideDistanceX,
                                                                                                            0,
                                                                                                            bomb.bombSideDistanceZ
                                                                                                            )
                                                                                                        );
                    break;

                default:
                    break;
                }

                BombObjects[i].transform.rotation = bombRotation;
            }

            SelectedBombDropHelper = bombDropTemplate;
        }
예제 #5
0
        private void ShowRemoteAndDropTemplate(ManeuverTemplate bombDropTemplate)
        {
            bombDropTemplate.ApplyTemplate(Selection.ThisShip, Selection.ThisShip.GetBack(), Direction.Bottom);

            Vector3    bombPosition = bombDropTemplate.GetFinalPosition();
            Quaternion bombRotation = bombDropTemplate.GetFinalRotation();

            // TODO: get type of remote from upgrade
            ShipFactory.SpawnRemote(
                (GenericRemote)Activator.CreateInstance(BombsManager.CurrentDevice.UpgradeInfo.RemoteType, Selection.ThisShip.Owner),
                bombPosition,
                bombRotation
                );

            SelectedBombDropHelper = bombDropTemplate;
        }
예제 #6
0
        private GameObject ShowTemporaryShipBase(Direction shiftDirection, bool isVisible = true)
        {
            GameObject prefab            = (GameObject)Resources.Load(TheShip.ShipBase.TemporaryPrefabPath, typeof(GameObject));
            GameObject temporaryShipBase = MonoBehaviour.Instantiate(
                prefab,
                SelectedTemplate.GetFinalPosition(),
                SelectedTemplate.GetFinalRotation(),
                Board.GetBoard()
                );

            int directionModifier = (SelectedDirectionPrimary == Direction.Left) ? -1 : 1;

            float finalShift = 0;

            switch (shiftDirection)
            {
            case Direction.Top:
                finalShift += (SelectedTemplate.IsSideTemplate) ? 0.5f : 0.25f;
                break;

            case Direction.Bottom:
                finalShift -= (SelectedTemplate.IsSideTemplate) ? 0.5f : 0.25f;
                break;

            default:
                break;
            }

            temporaryShipBase.transform.localEulerAngles += new Vector3(0, directionModifier * -90, 0);

            Vector3 shift = new Vector3(
                directionModifier * TheShip.ShipBase.HALF_OF_SHIPSTAND_SIZE,
                0,
                TheShip.ShipBase.HALF_OF_SHIPSTAND_SIZE + finalShift
                );
            Vector3 absPosition = temporaryShipBase.transform.TransformPoint(shift);

            temporaryShipBase.transform.position = absPosition;

            temporaryShipBase.transform.Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material = TheShip.Model.transform.Find("RotationHelper").Find("RotationHelper2").Find("ShipAllParts").Find("ShipBase").Find("ShipStandInsert").Find("ShipStandInsertImage").Find("default").GetComponent <Renderer>().material;
            temporaryShipBase.transform.Find("ShipBase").Find("ObstaclesStayDetector").gameObject.AddComponent <ObstaclesStayDetectorForced>();

            ToggleTemporaryShipBaseVisibility(temporaryShipBase, isVisible);

            return(temporaryShipBase);
        }