Exemple #1
0
 public void Awake()
 {
     //Get all of the scripts
     InteractionScript  = GetComponent <InteractionCommands>();
     CommandScript      = GetComponent <Commands>();
     CombatCommands     = GetComponent <CombatCommands>();
     MovementCommands   = GetComponent <MovementCommands>();
     DissectingScript   = GetComponent <DissectInputScript>();
     DialogueScript     = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>();
     PlayerScript       = GetComponent <Player>();
     InterfaceScript    = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>();
     ItemNameListScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <ItemNameList>();
     GameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
     if (!GameObject.FindGameObjectWithTag("CommandListHolder"))
     {
         Instantiate(gameObject, Vector3.zero, Quaternion.identity);
         gameObject.tag  = "CommandListHolder";
         gameObject.name = "CommandListHolder";
         gameObject.AddComponent <CommandList>();
         CommandListScript = gameObject.GetComponent <CommandList>();
     }
     else
     {
         CommandListScript = GameObject.FindGameObjectWithTag("CommandListHolder").GetComponent <CommandList>();
     }
     LevelScript = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>();
 }
Exemple #2
0
    void Awake()
    {
        //Get the name of the level, and if it is tutorial, get the PlayerSpawner and which class to spawn, set the state to PlayerTurn then disable this script
        string levelName = SceneManager.GetActiveScene().name;

        if (levelName == "Tutorial")
        {
            GameObject.FindGameObjectWithTag("ScriptHolder")
            .GetComponent <PlayerSpawner>()
            .SpawnPlayer(SceneManager.GetActiveScene().name, PlayerPrefs.GetString("Class"));
            _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
            _gameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn;
            this.enabled = false;
            return;
        }
        //If it is not tutorial, do the same until...
        GameObject.FindGameObjectWithTag("ScriptHolder")
        .GetComponent <PlayerSpawner>()
        .SpawnPlayer(SceneManager.GetActiveScene().name, PlayerPrefs.GetString("Class"));
        _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
        _gameTurnController.CurrentState = GameTurnController.PlayerState.PlayerTurn;
        //...this bit, where the script is not disabled, instead the LevelCounter is set to the levelname minus level (i.e. Level1 - Level = 1)
        var remove = levelName.Remove(0, 5);

        LevelCounter = int.Parse(remove);
        PlayerPrefs.SetInt("LevelCounter", LevelCounter);
    }
Exemple #3
0
 void Awake()
 {
     _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
     _uiScript           = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>();
     _levelScript        = GameObject.FindGameObjectWithTag("ScriptHolder").GetComponent <LevelScript>();
     _enemyName          = this.name.Remove(1, name.Length - 1);
     if (SceneManager.GetActiveScene().name == "Tutorial")
     {
         GetScripts();
     }
 }
    void Awake()
    {
        _dialogueScript = GetComponent <Dialogue>();
        int textCounter = 0;

        LevelUpImage.enabled = false;
        _gameTurnController  = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
        foreach (Text commandPoolText in CommandPoolTexts)
        {
            commandPoolText.text = textCounter < PlayerPrefs.GetInt("CommandsPool") ? "FREE COMMAND " : "CLOSED COMMAND";
            textCounter++;
        }
        InfoLevelText.text = "Your Level: " + PlayerPrefs.GetInt("Level");
    }
Exemple #5
0
    void Awake()
    {
        //Get the other scripts
        _gameTurnController = GameObject.FindGameObjectWithTag("GameController").GetComponent <GameTurnController>();
        _commandListScript  = GameObject.FindGameObjectWithTag("CommandListHolder").GetComponent <CommandList>();
        _dialogueScript     = GameObject.FindGameObjectWithTag("UI").GetComponent <Dialogue>();
        _commandsScript     = GetComponent <Commands>();
        _interfaceScript    = GameObject.FindGameObjectWithTag("UI").GetComponent <InterfaceScript>();

        //Fill up the command lists
        _tutorialCommands = new List <string> {
            "NEXT", "FINISHED", "PREVIOUS", "RESPAWN", "INFO"
        };
        _instantCommands = new List <string> {
            "ALIAS", "UNALIAS", "LEVEL", "RESTART", "HELP", "LIST", "EXPERIENCE", "STATS", "REST", "GAINLEVEL", "GETKEY", "CLOSE"
        };
        _nillOneTwoArgumentCommands = new List <string>()
        {
            "KICK", "WEAR", "LICK", "JUMP", "HIDE", "LOOK", "PUSH", "PULL", "GO", "HELP"
        };

        //Get the player class
        _className = PlayerPrefs.GetString("Class");
    }