Exemple #1
0
 public void spawnCharacter()
 {
     lvlFadeZero  = GameObject.Find("LevelFade0");
     lvlFade0     = lvlFadeZero.GetComponent <LevelFade>();
     playerScript = GameObject.FindObjectOfType <TopDownCharacterControllerScript>();
     playerScript.transform.position = playerSpawn[lvlFadeIndex];
     saveGame();
 }
Exemple #2
0
    //Player Spawn and Transitions

    void Awake()
    {
        //Placeholders for in-game progress
        newGameBool = false;
        enemyName   = "Land Mage";
        enemyLvl    = 3;
        playerLvl   = 1;
        quests      = new string[1];
        items       = new string[6];                          //Max 6 items
        itemQuant   = new int[6];                             //Items have 1 quant by default. You can have multiple potions, but only 1 equitment
        //spells.Add(Spell.);
        //spellsArray = Resources.FindObjectsOfTypeAll(typeof(Spell));
        //spells
        //spells = new string[6];
        //spells[0] = "Wind Scythe";
        items[0]     = "Health Potion";
        items[1]     = "Mana Potion";
        itemQuant[0] = 1;
        itemQuant[1] = 1;

        //Where the player spawns into different Scenes
        playerSpawn    = new Vector3[10];
        playerSpawn[0] = new Vector3(0f, 0f, 0f);            //MainMenu (will not be used)
        playerSpawn[1] = new Vector3(0f, 0f, 0f);            //MainTown (will not be used)
        playerSpawn[2] = new Vector3(0f, -9f, 0f);           //PurpleHouse1
        playerSpawn[3] = new Vector3(6f, 0.5f, 0f);          //Combat
        playerSpawn[4] = new Vector3(0f, -9f, 0f);           //PurpleShop1

        //Where the player spawns into the town from different Scenes
        playerTownSpawn    = new Vector3[10];
        playerTownSpawn[0] = new Vector3(0f, 0f, 0f);      //initial player spawn in position (on new game)
        playerTownSpawn[1] = new Vector3(0f, 0f, 0f);      //this can not happen
        playerTownSpawn[2] = new Vector3(-16.5f, 0f, 0f);  //from PurpleHouse1 to MainTown
        playerTownSpawn[3] = new Vector3(0f, 0f, 0f);      //from combat
        playerTownSpawn[4] = new Vector3(16.5f, 0f, 0f);   //from PurpleShop1 to MainTown

        //Array of Spell scriptable objects


        if (duplicateFix == null)
        {
            duplicateFix = this;
        }
        else
        {
            Destroy(this.gameObject);
        }
        //lvlFade = GameObject.FindObjectOfType<LevelFade>();
        lvlFadeZero  = GameObject.Find("LevelFade0");
        lvlFade0     = lvlFadeZero.GetComponent <LevelFade>();
        playerScript = GameObject.FindObjectOfType <TopDownCharacterControllerScript>();

        pauseMenuUI.SetActive(false);
        //interactionKeyPopup.GetComponentInChildren<TextMeshProUGUI>().color = new Color();
        DontDestroyOnLoad(this.gameObject);
    }
Exemple #3
0
 public void spawnCharacterInMainTown()
 {
     lvlFadeZero  = GameObject.Find("LevelFade0");
     lvlFade0     = lvlFadeZero.GetComponent <LevelFade>();
     playerScript = GameObject.FindObjectOfType <TopDownCharacterControllerScript>();
     if (newGameBool)
     {
         playerScript.transform.position = playerTownSpawn[0];
     }
     else
     {
         playerScript.transform.position = playerTownSpawn[lvlFadeIndex];
     }
     saveGame();
 }