private void StartReposition() { GenericRemote remote = HostShip as GenericRemote; SelectedManeuverTemplate.ApplyTemplate(remote, SelectedJointIndex); GameManagerScript.Wait(1, ContinueReposition); }
public void ApplyTemplate(GenericRemote remote, int jointNumber) { if (TemplateGO == null) { GameObject prefab = Resources.Load <GameObject>("Prefabs/ManeuverTemplates/" + TemplatePrefabName); TemplateGO = GameObject.Instantiate <GameObject>(prefab, Board.GetBoard()); FinisherGO = TemplateGO.transform.Find("Finish").gameObject; } TemplateGO.transform.position = remote.GetJointPosition(jointNumber); float directionFix = (Direction == ManeuverDirection.Left) ? 180 : 0; TemplateGO.transform.eulerAngles = remote.GetJointAngles(jointNumber) + new Vector3(0, 180, 0); TemplateGO.transform.localEulerAngles = new Vector3( TemplateGO.transform.localEulerAngles.x, TemplateGO.transform.localEulerAngles.y, directionFix ); FinisherGO.transform.localEulerAngles = new Vector3( FinisherGO.transform.localEulerAngles.x, FinisherGO.transform.localEulerAngles.y, directionFix ); }
public override void Start() { base.Start(); Name = "Remote Setup SubPhase"; inReposition = false; GenericRemote remote = ShipFactory.SpawnRemote( (GenericRemote)Activator.CreateInstance(RemoteType, RemoteOwner), Vector3.zero, new Quaternion(0, 0, 0, 0) ); Selection.ThisShip = remote; if (RemoteOwner is HumanPlayer) { ShowSubphaseDescription(DescriptionShort, DescriptionLong, ImageSource); } Board.ToggleOffTheBoardHolder(true); StartDrag(); Roster.GetPlayer(RequiredPlayer).SetupRemote(); }
public static void SpawnRemove(GenericRemote remote, Vector3 position, Quaternion rotation) { remote.SpawnModel(ShipFactory.lastId++, position, rotation); remote.AfterGotNumberOfDefenceDice += Rules.DistanceBonus.CheckDefenceDistanceBonus; remote.OnPositionFinish += Rules.OffTheBoard.CheckOffTheBoard; remote.OnShipIsRemoved += Rules.Destruction.WhenShipIsRemoved; remote.BeforeTokenIsAssigned += Rules.Remotes.AllowOnlyLocks; remote.OnTokenIsAssigned += Roster.UpdateTokensIndicator; remote.OnTokenIsRemoved += Roster.UpdateTokensIndicator; remote.AfterAssignedDamageIsChanged += Roster.UpdateRosterHullDamageIndicators; remote.AfterAssignedDamageIsChanged += Roster.UpdateRosterShieldsDamageIndicators; remote.AfterStatsAreChanged += Roster.UpdateShipStats; }