Example #1
0
        public void SelectSlot(int slot)
        {
            State = UIState.DISABLED;

            if (CheckSlot(slot))
            {
                Battle.main = Battle.CreateBattle(saveSlotContents[slot]);
                BattleUIAgent.FindAgent(x => { return(true); }, typeof(TurnNotifier)).gameObject.SetActive(true);
            }
            else
            {
                BattleTweaker.saveSlot = slot;
                Next();
            }
        }
Example #2
0
        public virtual void Place(Tile[] location)
        {
            location = location != null ? (location.Length == 0 ? null : location) : null;
            if (location != null)
            {
                for (int i = 0; i < location.Length; i++)
                {
                    location[i].containedShip = this;
                }

                Vector3 directional = location[0].transform.position - location[location.Length - 1].transform.position;
                placementInfo.boardPosition = (location[0].transform.position + location[location.Length - 1].transform.position) / 2.0f;
                placementInfo.boardRotation = Quaternion.Euler(0, directional.z != 0 ? 0 : 90, 0);

                parentBoard.placementInfo.notplacedShips.Remove(this);
                parentBoard.placementInfo.placedShips.Add(this);
                transform.SetParent(parentBoard.transform);

                tiles = location;

                foreach (Ship ship in parentBoard.placementInfo.placedShips)
                {
                    if (ship != this)
                    {
                        ship.OnOtherShipPlacementOntoBoard(this, location);
                    }
                }
            }
            else
            {
                transform.SetParent(BattleUIAgent.FindAgent(x => { return(true); }, typeof(BattleUIAgents.Agents.Shipbox)).transform);
                tiles = location;
            }

            if (!parentBoard.owner.aiEnabled)
            {
                placementInfo.waypoints = new List <Vector3>();

                Vector3 targetPosition = location != null ? placementInfo.boardPosition + Vector3.up * MiscellaneousVariables.it.boardUIRenderHeight : BattleUIAgent.FindAgent(x => { return(true); }, typeof(BattleUIAgents.Agents.Shipbox)).transform.TransformPoint(placementInfo.localShipboxPosition);
                placementInfo.waypoints.Add(new Vector3(targetPosition.x, MiscellaneousVariables.it.boardUIRenderHeight + 4.0f, targetPosition.z));
                placementInfo.waypoints.Add(targetPosition);
            }

            parentBoard.ReevaluateTiles();

            parentBoard.placementInfo.selectedShip = null;
        }
Example #3
0
 public void LaunchBattle()
 {
     Battle.main = Battle.CreateBattle(Battle.GetBlankBattleData((int)boardSizeSlider.value, aiOpponent, tutorialToggle.isOn, saveSlot, flags));
     State       = UIState.DISABLED;
     BattleUIAgent.FindAgent(x => { return(true); }, typeof(TurnNotifier)).gameObject.SetActive(true);
 }