コード例 #1
0
    public SpaceShipData[] GetSourceSpaceShipDatas()
    {
        // TEMP
        //if (m_sourceSpaceShips.Count < (int)MobType.End)
        //{
        //    Debug.LogError("The sourc turrets is less than Turret.End");
        //    return null;
        //}

        SpaceShipData[] datas = new SpaceShipData[(int)MobType.End];

        for (int i = 0; i < (int)MobType.End; ++i)
        {
            string key = EnumToStr((MobType)i);

            GameObject source = null;

            if (false == m_sourceSpaceShips.TryGetValue(key, out source))
            {
                datas[i] = null;
                continue;
            }

            SpaceShipCtrl ctrl = source.GetComponent <SpaceShipCtrl>();

            datas[i] = ctrl.SpaceShipData;
        }

        return(datas);
    }
コード例 #2
0
 private void Awake()
 {
     DontDestroyOnLoad(this);
     instance        = this;
     userData        = SaveData.LoadUserData();
     currentShipData = GetCurrentShipData();
     InstantiateShip();
 }
コード例 #3
0
        private void InitializeSpaceShipData()
        {
            var spaceShip = new SpaceShipData();

            spaceShip.Name         = "SGS Mijago";
            spaceShip.GridPosition = Vector3Int.zero;
            spaceShip.Position     = spaceShip.GridPosition;
            spaceShip.Engine       = new ShipEngine();

            var playerData = new PlayerData();

            playerData.SpaceShipData = spaceShip;

            GameState.PlayerData = playerData;
        }
コード例 #4
0
    public bool BuyShip(SpaceShipData shipData)
    {
        if (shipData.shipPrice <= userData.playerData.diamond)
        {
            //buy ship and return true

            userData.playerData.ChangeDiamond(-shipData.shipPrice);
            userData.shipControlData.SetCurrentShipName(shipData.shipName);
            shipData.isBought = true;

            SaveUserData();

            return(true);
        }
        return(false);
    }
コード例 #5
0
ファイル: Garage.cs プロジェクト: afc-afc0/ToTheSpace
    void Start()
    {
        spaceShipData = DataManager.Instance.GetShipByName(shipName);
        if (shipName == null)
        {
            Debug.LogError("ship name is null");
        }
        if (buttonControl == null)
        {
            Debug.LogError("Button control not initiliazed");
        }
        if (shipName == null)
        {
            Debug.LogError("ship name is null");
        }


        SetAmounts();
        SetAmountTexts();
        GetSpaceShipStates();
        UpdateButtons();
        SetBuyOrSelectButton();
    }