void OnEnable()
    {
        if(gameManager == null)
            gameManager = GameObject.Find("GameManager").GetComponent<ScriptGameManager>();

        UpdateDifficultySelection();
    }
Exemplo n.º 2
0
 // Use this for initialization
 void Start()
 {
     gameManager  = GameObject.Find("_GM").GetComponent <ScriptGameManager>();
     deathCanvas  = GameObject.Find("DeathCanvas");
     winCanvas    = GameObject.Find("WinCanvas");
     screenCanvas = GameObject.Find("ScreenCanvas");
     startWall    = GameObject.Find("StartWall");
 }
 private void Start()
 {
     gm           = FindObjectOfType <ScriptGameManager>();
     isPartenaire = false;
     GetComponent <Rigidbody>().constraints = RigidbodyConstraints.FreezeAll;
     distanceMin = 7;
     agent       = this.GetComponent <NavMeshAgent>();
     agent.speed = GetComponent <ClassUnite>().GetMouvemenetVitesse();
 }
Exemplo n.º 4
0
 void Start()
 {
     gm = FindObjectOfType <ScriptGameManager>();
     if (GetComponent <ScriptMonstre>())
     {
         estMonstre = true;
     }
     else
     {
         estMonstre = false;
     }
 }
Exemplo n.º 5
0
    void Start()
    {
        List <int> lstat = new List <int>();

        timeur = 0;
        unite  = gameObject.AddComponent <ClassUnite>();
        unite.SetNom("Monstre" + NUMBER_MONSTER.ToString());
        unite.SetMaxPointDeVie(75);
        unite.SetAttaque(25);
        unite.SetDefence(5);
        unite.SetMouvementVitesse(5);
        unite.SetVitesseAttaque(3);
        NUMBER_MONSTER++;
        GameManager = FindObjectOfType <ScriptGameManager>();
        taunted     = false;
    }
 private float currentDirection = 1f;  //current facing
 // Use this for initialization
 void Start()
 {
     cheatMode = Difficulty.Cheat;  //get value from the static class
     GM        = GameObject.Find("_GM").GetComponent <ScriptGameManager>();
     AudioSource[] audios = GetComponents <AudioSource>();
     anim        = GetComponent <Animator>();
     rb2d        = GetComponent <Rigidbody2D>();
     shootAudio  = audios[0];
     hitAudio    = audios[2];
     jumpAudio   = audios[1];
     killedAudio = audios[3];
     Run         = audios[4];
     if (cheatMode == true)  //if cheat enabled
     {
         isTutorial = true;
         HP         = 999;
     }
 }
    public void InitList()
    {
        gameManager = GameObject.Find("GameManager").GetComponent<ScriptGameManager>();
        receivingPlayerName = "";

        foreach(ScriptPlayer player in gameManager.players)
        {
            GameObject newButton = (GameObject)Instantiate(prefabPlayerSelectButton);
            SampleButtonPlayer tempButton = newButton.GetComponent<SampleButtonPlayer>();

            tempButton.name = player.playerName + " Button";
            tempButton.playerName.text = player.playerName;

            tempButton.button.onClick.AddListener(delegate { SelectPlayer(tempButton.playerName.text); });

            newButton.transform.SetParent(contentPanel);
        }
    }
    //TODO: Debuger Niveau 2 Collision Tete Boss serpent
    void Awake()
    {
        /***make sure that only one gameManager is Active in all the scenes
         * ref: https://unity3d.com/fr/learn/tutorials/topics/scripting/persistence-saving-and-loading-data***/
        txtnbVies  = this.txtnbVies;
        txtnbBombe = this.txtnbBombe;

        if (gameManager == null)
        {
            Debug.Log("==> This is the GameManager");
            DontDestroyOnLoad(gameObject);
            gameManager = this;
        }
        else if (gameManager && gameManager != this)
        {
            Debug.Log("==> GameManager Detected this instance will be destroied!");
            Destroy(gameObject);
        }
    }
Exemplo n.º 9
0
 void Update()
 {
     gameManager       = GameObject.Find("GameManager");
     scriptGameManager = gameManager.GetComponent <ScriptGameManager>();
 }
 void Start()
 {
     gameManager = GameObject.Find("GameManager").GetComponent<ScriptGameManager>();
     UpdateDifficultySelection();
 }
Exemplo n.º 11
0
    //Mike Dobson & Andrew Seba Engine collaberation from here down unless otherwise noted
    void Start()
    {
        gameManager = GameObject.Find("GameManager").GetComponent<ScriptGameManager>();

        // Craig
        if (gameManager.restartedGame)
        {
            // load player data from the saved game data using the player's name (public string playerName)
        }

        wood = 0;
        wool = 0;
        brick = 0;
        grain = 0;
        numSettlements = 0;

        settlements = new List<GameObject>();
        roads = new List<GameObject>();

        try
        {
            BuildPhaseMenu = GameObject.Find("Panel_BuildMenu");

            if (BuildPhaseMenu != null) {
                BuildSettlementButton = GameObject.Find("Button_BuildRoad");
                BuildRoadButton = GameObject.Find("Button_BuildSettlement");

                BuildPhaseMenu.SetActive(false);
            }
            else
            {
                Debug.Log("Panel_BuildMenu can't be found. Please re-enable in scene before running.");
            }

            tradeWindowButton = GameObject.Find("Button_OpenTradeWindow");

            if(tradeWindowButton != null)
            {
                tradeWindowButton.SetActive(false);
            }
            else
            {
                Debug.LogError("Button_OpenTradeWindow can't be found. Please re-enable in hierarchy before running.");
            }

            PhaseText = GameObject.Find("Text_CurPhase").GetComponent<Text>();
            grainAmount = GameObject.Find("Text_GrainAmount").GetComponent<Text>();
            brickAmount = GameObject.Find("Text_BrickAmount").GetComponent<Text>();
            woodAmount = GameObject.Find("Text_WoodAmount").GetComponent<Text>();
            woolAmount = GameObject.Find("Text_WoolAmount").GetComponent<Text>();
        }
        catch
        {
            Debug.Log("no gui object found in scene.");
        }

        CurrentState = GameState.PHASE0;

        //setup the previous state
        PreviousState = GameState.PHASE0;

        //create the dictionary
        allTransitions = new Dictionary<ScriptPhaseTransition, GameState>
        {
            //Defines the state transitions where
            //{new ScriptPhaseTransition(actual state of the machine, transition state/command), final state of the machine)}
            {new ScriptPhaseTransition(GameState.PHASE0, StateCommands.GOTO_PHASE5), GameState.PHASE5 },
            {new ScriptPhaseTransition(GameState.PHASE1, StateCommands.GOTO_PHASE2), GameState.PHASE2 },
            {new ScriptPhaseTransition(GameState.PHASE2, StateCommands.GOTO_PHASE3), GameState.PHASE3 },
            {new ScriptPhaseTransition(GameState.PHASE3, StateCommands.GOTO_PHASE4), GameState.PHASE4 },
            {new ScriptPhaseTransition(GameState.PHASE4, StateCommands.GOTO_PHASE2), GameState.PHASE2 },
            {new ScriptPhaseTransition(GameState.PHASE4, StateCommands.GOTO_PHASE3), GameState.PHASE3 },
            {new ScriptPhaseTransition(GameState.PHASE4, StateCommands.GOTO_PHASE5), GameState.PHASE5 },
            {new ScriptPhaseTransition(GameState.PHASE5, StateCommands.GOTO_PHASE1), GameState.PHASE1 },
            {new ScriptPhaseTransition(GameState.PHASE5, StateCommands.GOTO_PHASE6), GameState.PHASE6 }
        };

        //Create the dictionary where
        //{string that is passed by the button, command the string represents
        enumParse = new Dictionary<string, StateCommands>
        {
            {"goto phase 0", StateCommands.GOTO_PHASE0},
            {"goto phase 1", StateCommands.GOTO_PHASE1},
            {"goto phase 2", StateCommands.GOTO_PHASE2},
            {"goto phase 3", StateCommands.GOTO_PHASE3},
            {"goto phase 4", StateCommands.GOTO_PHASE4},
            {"goto phase 5", StateCommands.GOTO_PHASE5},
            {"goto phase 6", StateCommands.GOTO_PHASE6},
            {"quit application", StateCommands.QUIT_APPLICATION}
        };

        Debug.Log("Current state: " + CurrentState);
        //Phase0();
    }
 void Start()
 {
     GetComponent <Rigidbody2D>().velocity = transform.up * speed * Time.timeScale;
     gameManager       = GameObject.Find("GameManager");
     scriptGameManager = gameManager.GetComponent <ScriptGameManager>();
 }