void Start() { _towerExist = false; _confirmed = false; _towerIndex = -1; _clearBeforeBattle = false; _currentTowerType = -1; _levelManager = GameManager.Instance.CurrentLevelManager; _gameBoard = _levelManager.GameBoardSystem; _towerController = TowerController.Instance; _towerBuildPanel = TowerBuildPanel.Instance; _towerOperationPanel = TowerOperationPanel.Instance; _towerInfoPanel = TowerInfoPanel.Instance; _buildCheckPanel = BuildCheckPanel.Instance; _notificationPanel = NotificationPanel.Instance; _tankTowerButton = TankTowerButton.Instance; _rangeTowerButton = RangeTowerButton.Instance; _slowTowerButton = SlowTowerButton.Instance; _healTowerButton = HealTowerButton.Instance; _goldTowerButton = GoldTowerButton.Instance; _upgradeButton = UpgradeButton.Instance; _repairButton = RepairButton.Instance; _sellButton = SellButton.Instance; _yesButton = BCP_Yes.Instance; TowerOperation = Operation.Nop; }
void Start() { ThisPanel.SetActive(false); _upgradeTowerInfo = new int[11]; _towerInfo = new int[11]; _levelManager = GameManager.Instance.CurrentLevelManager; _repairButton = RepairButton.Instance; _displayUpgradedInfo = false; _repairCase = false; _set = false; }
/// <summary> /// Code to run each tick /// </summary> private void Tick() { //DEBUG //GM.textM.Draw(FontBank.arcadePixel, // "Hull Front " + hitBoxHullFront.Health + "~Hull Back " + hitBoxHullBack.Health + "~Hull Left " + hitBoxHullLeft.Health + "~Hull Right " + hitBoxHullRight.Health + // "~Sail Front " + hitBoxSailFront.Health + "~Sail Middle " + hitBoxSailMiddle.Health + "~Sail Back " + hitBoxSailBack.Health, 100, 100, TextAtt.TopLeft); GM.textM.Draw(FontBank.arcadePixel, "Crew: " + CrewNum + "~~Ammunition:~ Round: " + roundShotNum + "~ Bar: " + barShotNum + "~ Carcass: " + carcassShotNum + "~ Grape: " + grapeShotNum + "~ Grapple: " + grappleShotNum + "~~Repair Materials:~ Hull: " + (int)hullRepMats + "~ Sail: " + (int)sailRepMats, 100, 50, TextAtt.TopLeft); //Sinking bar UISinkBarTop.SY = sinkAmount * 0.1f; //Make camera follow player GameSetup.PlayerView.Position = Position - new Vector3(GM.screenSize.Center.X, GM.screenSize.Center.Y - 100, 0); //UI updates if (!tiReloadRight.Paused && !IsRepairing) { UIReloadRight.Visible = true; float heightMul = (tiReloadRight.Interval - tiReloadRight.ElapsedSoFar) / tiReloadRight.Interval; UIReloadRight.SY = 50 * heightMul; } if (!tiReloadLeft.Paused && !IsRepairing) { UIReloadLeft.Visible = true; float heightMul = (tiReloadLeft.Interval - tiReloadLeft.ElapsedSoFar) / tiReloadLeft.Interval; UIReloadLeft.SY = 50 * heightMul; } //Mouse inputs //Set sail amount if (speedButton.PressedLeft()) { if (sailAmount == 0) { sailAmount++; speedButton.SetDisplay(new Rectangle(82, 159, 12, 40)); } else if (sailAmount == 1) { sailAmount++; speedButton.SetDisplay(new Rectangle(95, 159, 12, 40)); } } else if (speedButton.PressedRight()) { if (sailAmount == 1) { sailAmount--; speedButton.SetDisplay(new Rectangle(75, 159, 6, 40)); } else if (sailAmount == 2) { sailAmount--; speedButton.SetDisplay(new Rectangle(82, 159, 12, 40)); } } //Set shot type if (fireRightButton.PressedRight()) { GM.eventM.AddTimer(tiReloadLeft = new Event(10, "Reload Cooldown Right")); switch (shotTypeRight) { case 0: shotTypeRight = 1; fireRightButton.SetDisplay(new Rectangle(190, 164, 28, 12)); break; case 1: shotTypeRight = 2; fireRightButton.SetDisplay(new Rectangle(238, 152, 20, 28)); break; case 2: shotTypeRight = 3; fireRightButton.SetDisplay(new Rectangle(278, 156, 28, 28)); break; case 3: shotTypeRight = 4; fireRightButton.SetDisplay(new Rectangle(326, 160, 20, 20)); break; case 4: shotTypeRight = 0; fireRightButton.SetDisplay(new Rectangle(150, 160, 20, 20)); break; } } if (fireLeftButton.PressedRight()) { GM.eventM.AddTimer(tiReloadRight = new Event(10, "Reload Cooldown Left")); switch (shotTypeLeft) { case 0: shotTypeLeft = 1; fireLeftButton.SetDisplay(new Rectangle(190, 164, 28, 12)); break; case 1: shotTypeLeft = 2; fireLeftButton.SetDisplay(new Rectangle(238, 152, 20, 28)); break; case 2: shotTypeLeft = 3; fireLeftButton.SetDisplay(new Rectangle(278, 156, 28, 28)); break; case 3: shotTypeLeft = 4; fireLeftButton.SetDisplay(new Rectangle(326, 160, 20, 20)); break; case 4: shotTypeLeft = 0; fireLeftButton.SetDisplay(new Rectangle(150, 160, 20, 20)); break; } } //Fire cannons if (fireRightButton.PressedLeft()) { Fire(true, shotTypeRight); } if (fireLeftButton.PressedLeft()) { Fire(false, shotTypeLeft); } if (fireRightButton.Hover()) { fireZone.Visible = true; fireZone.Position2D = Position2D - RotationHelper.Direction2DFromAngle(RotationAngle, 90) * 220; fireZone.RotationAngle = RotationAngle; } else if (fireLeftButton.Hover()) { fireZone.Visible = true; fireZone.Position2D = Position2D + RotationHelper.Direction2DFromAngle(RotationAngle, 90) * 220; fireZone.RotationAngle = RotationAngle; } else { fireZone.Visible = false; } //Repair ship if (RepairButton.PressedLeft()) { IsRepairing = true; } if (RepairButton.PressedRight()) { IsRepairing = false; if (!leftLoaded) { tiReloadLeft.Paused = false; } if (!rightLoaded) { tiReloadRight.Paused = false; } } if (IsRepairing) { fireLeftButton.Faded = true; fireRightButton.Faded = true; } else { fireLeftButton.Faded = false; fireRightButton.Faded = false; } //Cut boarding ropes if (cutRopeButton.PressedLeft() && (isBoarded || isBoarding)) { cutBoardingRopes(); } if (!isBoarded && !isBoarding) { cutRopeButton.Faded = true; } else { cutRopeButton.Faded = false; } //Movement orders //Check that no clicks are made on UI background for (int i = 0; i < UIBackgroundElements.Length; i++) { if (UIBackgroundElements[i].PressedLeft() || UIBackgroundElements[i].PressedRight() || UIBackgroundElements[i].HeldLeft() || UIBackgroundElements[i].HeldRight()) { } } if (buttonPressed == false) { if (GM.inputM.MouseRightButtonPressed()) { cursor.Mode = 1; movePath = new Queue <Point>(100); moveTo = PointHelper.PointFromVector2(cursor.Position2D + Position2D + new Vector2(-800, -350)); movePath.Enqueue(moveTo); moveTargetReached = false; arrowQueue.Reset(); } else if (GM.inputM.MouseRightButtonHeld() && PointHelper.DistanceSquared( new Point((int)(GameSetup.PlayerView.ViewPortOutline.Left + GM.inputM.MouseLocation.X), (int)(GameSetup.PlayerView.ViewPortOutline.Top + GM.inputM.MouseLocation.Y)), moveTo) > 1000) { cursor.Mode = 2; Vector2 newMoveTo = cursor.Position2D + Position2D + new Vector2(-800, -350); if (movePath.Count == 1) { arrowQueue = new ArrowQueue(PointHelper.Vector2FromPoint(moveTo), newMoveTo); } else { arrowQueue.Enqueue(newMoveTo); } moveTo = PointHelper.PointFromVector2(newMoveTo); movePath.Enqueue(moveTo); } else { cursor.Mode = 0; } } else { buttonPressed = false; } if (moveTargetReached == false) { if (movePath.Count > 0) { MoveToPoint(movePath.Peek()); } else { moveTargetReached = true; } } }
void Awake() { Instance = this; }
void ReleaseDesignerOutlets() { if (EngineLabel != null) { EngineLabel.Dispose(); EngineLabel = null; } if (LocationTextField != null) { LocationTextField.Dispose(); LocationTextField = null; } if (MapMoveCheckbox != null) { MapMoveCheckbox.Dispose(); MapMoveCheckbox = null; } if (NotificationCheckbox != null) { NotificationCheckbox.Dispose(); NotificationCheckbox = null; } if (OpenGameFolderButton != null) { OpenGameFolderButton.Dispose(); OpenGameFolderButton = null; } if (OpenReplayCheckbox != null) { OpenReplayCheckbox.Dispose(); OpenReplayCheckbox = null; } if (PassLabel != null) { PassLabel.Dispose(); PassLabel = null; } if (PassProgress != null) { PassProgress.Dispose(); PassProgress = null; } if (PassTable != null) { PassTable.Dispose(); PassTable = null; } if (RepairButton != null) { RepairButton.Dispose(); RepairButton = null; } if (ReplayOpenCheckbox != null) { ReplayOpenCheckbox.Dispose(); ReplayOpenCheckbox = null; } if (ReportButton != null) { ReportButton.Dispose(); ReportButton = null; } if (ScanButton != null) { ScanButton.Dispose(); ScanButton = null; } if (SkinMoveCheckbox != null) { SkinMoveCheckbox.Dispose(); SkinMoveCheckbox = null; } if (UpdateButton != null) { UpdateButton.Dispose(); UpdateButton = null; } if (UpdateProgress != null) { UpdateProgress.Dispose(); UpdateProgress = null; } }