Exemplo n.º 1
0
    public DataObject(SO_Characters.CharacterScriptable[] characterScriptables, SO_Airships.AirshipScriptable[] airshipScriptables)
    {
        this.dateLastSaved = DateTime.Now;

        // Populate character inventory with 4 characters.
        this.characterInventory = new List <CharacterSerialized> ();
        this.characterInventory.Add(characterScriptables [(int)GameEnum.CharacterName.EMPTY].characterData.Clone());
        this.characterInventory.Add(characterScriptables [(int)GameEnum.CharacterName.MAIN_BOB].characterData.Clone());
        this.characterInventory.Add(characterScriptables [(int)GameEnum.CharacterName.MAIN_LILY].characterData.Clone());
        this.characterInventory.Add(characterScriptables [(int)GameEnum.CharacterName.MAIN_SAM].characterData.Clone());
        this.characterInventory.Add(characterScriptables [(int)GameEnum.CharacterName.MAIN_TIM].characterData.Clone());

        // Set current airship at 0.
        this.currentAirship = GameEnum.AirshipName.KOALA;

        // Save all airship data to binary.
        this.airships = new AirshipSerialized[airshipScriptables.Length];
        for (int i = 0; i < this.airships.Length; i++)
        {
            this.airships[i] = airshipScriptables[i].airshipData.Clone();
        }
        // Unlock the first airship.
        this.airships [(int)GameEnum.AirshipName.KOALA].isLocked = false;

        // Save characters from 0 and 1 (inventory index) into characterInventory.
        int airshipSlots = airshipScriptables[(int)this.currentAirship].slots.Length;

        this.charInAirshipSlotToInventory     = new int[airshipSlots];
        this.charInAirshipSlotToInventory [0] = 1;
        this.charInAirshipSlotToInventory [1] = 2;
        this.charInAirshipSlotToInventory [2] = 3;
        //this.charInAirshipSlotToInventory [3] = 4;

        // Save empty standby characters.
        int standbySlots = airshipScriptables[(int)this.currentAirship].standbySlots.Length;

        this.standbyInAirshipSlotToInventory     = new int[standbySlots];
        this.standbyInAirshipSlotToInventory [0] = 0;
        this.standbyInAirshipSlotToInventory [1] = 0;

        // Setup missions and objectives.
        A_Objective[]       objectives    = new A_Objective[1];
        Objective_KillEnemy kill_kamikaze = new Objective_KillEnemy("Kill the Kamikaze enemy.", "Kill the Kamikaze enemy.", GameEnum.EnemyName.ENEMY_KAMIKAZE);

        objectives[0] = kill_kamikaze;
        Mission m0 = new Mission("Tutorial", "This is the tutorial mission.", "Level_LayerTest", objectives);

        this.missions    = new Mission[1];
        this.missions[0] = m0;
    }
Exemplo n.º 2
0
    public void OpenMenu(LoadoutMenuController controller, int airshipNum)
    {
        GameEnum.AirshipName airshipName = (GameEnum.AirshipName)airshipNum;
        this.layout.sprite = GameManager.instance.Data.GetAirshipLayout(airshipName);
        int airshipSlotsNum        = GameManager.instance.Data.GetAirshipSlotsNum(airshipName);
        int airshipStandbySlotsNum = GameManager.instance.Data.GetAirshipStandbySlotsNum(airshipName);

        for (int i = 0; i < this.slots.Length; i++)
        {
            if (i < airshipSlotsNum)
            {
                this.slots[i].parentRt.gameObject.SetActive(true);
                int inventoryNum = GameManager.instance.Data.GetCharactersInAirship()[i];
                this.slots[i].image.sprite = GameManager.instance.Data.GetInventoryCharacterSpriteIcon(inventoryNum);

                AirshipCharacterSlot slotInfo = GameManager.instance.Data.GetAirshipSlotInfo(airshipName, i);
                this.slots[i].parentRt.anchoredPosition = new Vector2(slotInfo.centerX, slotInfo.centerY);
                this.slots[i].parentRt.sizeDelta        = new Vector2(slotInfo.width, slotInfo.height);
            }
            else
            {
                this.slots[i].parentRt.gameObject.SetActive(false);
            }
        }

        for (int i = 0; i < this.standbySlots.Length; i++)
        {
            if (i < airshipStandbySlotsNum)
            {
                this.standbySlots[i].parentRt.gameObject.SetActive(true);
                int inventoryNum = GameManager.instance.Data.GetCharactersStandbyInAirship()[i];
                this.standbySlots[i].image.sprite = GameManager.instance.Data.GetInventoryCharacterSpriteIcon(inventoryNum);

                AirshipCharacterSlot slotInfo = GameManager.instance.Data.GetAirshipStandbySlotInfo(airshipName, i);
                this.standbySlots[i].parentRt.anchoredPosition = new Vector2(slotInfo.centerX, slotInfo.centerY);
                this.standbySlots[i].parentRt.sizeDelta        = new Vector2(slotInfo.width, slotInfo.height);
            }
            else
            {
                this.standbySlots[i].parentRt.gameObject.SetActive(false);
            }
        }
    }
Exemplo n.º 3
0
 public AirshipSerialized(GameEnum.AirshipName airshipName, string name)
 {
     this.airshipName = airshipName;
     this.name        = name;
 }
Exemplo n.º 4
0
 public Sprite GetAirshipLayout(GameEnum.AirshipName name)
 {
     return(this.airshipScriptables.airships[(int)name].layout);
 }
Exemplo n.º 5
0
 public void SetCurrentAirship(GameEnum.AirshipName airshipName)
 {
     this.dataObject.currentAirship = airshipName;
 }
Exemplo n.º 6
0
 public Sprite GetAirshipIcon(GameEnum.AirshipName name)
 {
     return(this.airshipScriptables.airships[(int)name].icon);
 }
Exemplo n.º 7
0
 public GameObject GetCurrentAirshipPrefab(GameEnum.AirshipName name)
 {
     return(this.airshipScriptables.airships[(int)name].prefab);
 }
Exemplo n.º 8
0
 public int GetAirshipStandbySlotsNum(GameEnum.AirshipName name)
 {
     return(this.airshipScriptables.airships[(int)name].standbySlots.Length);
 }
Exemplo n.º 9
0
 public AirshipCharacterSlot GetAirshipStandbySlotInfo(GameEnum.AirshipName name, int slotNum)
 {
     return(this.airshipScriptables.airships[(int)name].standbySlots[slotNum]);
 }
Exemplo n.º 10
0
 public bool IsAirshipLocked(GameEnum.AirshipName name)
 {
     return(this.dataObject.airships[(int)name].isLocked);
 }