Inheritance: MonoBehaviour
Example #1
0
 //it is called when the play button is clicked
 public void Play()
 {
     hud = this;
     menuHUD.transform.gameObject.SetActive(false);
     gameHUD.transform.gameObject.SetActive(true);
     Board.board.StartGame();
 }
Example #2
0
    public void Save()
    {
        HUD_Manager HUDScript = GetComponent <HUD_Manager>();

        System.IO.File.WriteAllText("Assets/Asset Test/Saves/Save.txt", HUDScript.HealthAmount.ToString() + "\n" + HUDScript.ArmorAmount.ToString() + "\n" + HUDScript.Rank
                                    + "\n" + HUDScript.Reputation.ToString() + "\n" + HUDScript.Money.ToString());
    }
 private void Awake()
 {
     if (!HudManager)
     {
         HudManager = this;
         DontDestroyOnLoad(this);
     }
 }
Example #4
0
	// Singleton pattern
	void Awake()
	{
		if (instance == null)				//Check if instance already exists
			instance = this;				//if not, set instance to this
		else if (instance != this)			//If instance already exists and it's not this:
			Destroy(gameObject);   			//Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager. 
		DontDestroyOnLoad(gameObject);		//Sets this to not be destroyed when reloading scene
	}
Example #5
0
    void OnTriggerEnter(Collider other)
    {
        HUD_Manager hudmanager = other.gameObject.GetComponent <HUD_Manager>();

        if (hudmanager != null)
        {
            hudmanager.UpdateHealth(AttackDamage);
        }
    }
Example #6
0
 //Static instance check
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Example #7
0
 void Start()
 {
     camera              = GameObject.Find("Main Camera").GetComponent <CameraWork>();
     hUD_Manager         = GetComponent <HUD_Manager>();
     hUD_Manager.enabled = false;
     for (int i = 0; i < transform.childCount; i++)
     {
         transform.GetChild(i).gameObject.SetActive(false);
         flag = false;
     }
 }
Example #8
0
	// Singleton pattern
	void Awake()
	{
		//Check if instance already exists
		if (instance == null)				
			//if not, set instance to this
			instance = this;				
		//If instance already exists and it's not this:
		else if (instance != this)			
			//Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
			Destroy(gameObject);   			
	}
Example #9
0
 // Singleton pattern
 void Awake()
 {
     if (instance == null)                           //Check if instance already exists
     {
         instance = this;                            //if not, set instance to this
     }
     else if (instance != this)                      //If instance already exists and it's not this:
     {
         Destroy(gameObject);                        //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
     }
     DontDestroyOnLoad(gameObject);                  //Sets this to not be destroyed when reloading scene
 }
Example #10
0
 // Singleton pattern
 void Awake()
 {
     //Check if instance already exists
     if (instance == null)
     {
         //if not, set instance to this
         instance = this;
     }
     //If instance already exists and it's not this:
     else if (instance != this)
     {
         //Then destroy this. This enforces our singleton pattern, meaning there can only ever be one instance of a GameManager.
         Destroy(gameObject);
     }
 }
Example #11
0
    // Start is called before the first frame update
    void Start()
    {
        instance = this;
        hud_manager = GameObject.Find("Game Management").GetComponent<HUD_Manager>();

        foreach (Button button in GetComponentsInChildren<Button>())
        {
            if (!button.name.Contains("Detail") && !button.name.Contains("Disband"))
            {
                squad_buttons.Add(button);
            }
        }

        beginpos = squad_buttons[0].transform.position;
    }
 void Awake()
 {
     if (Instance == null)
     {
         Instance  = this;
         rectTrans = GetComponent <RectTransform>();
         dialogueBox.SetActive(false);
         nextLevelPanel.SetActive(false);
         DontDestroyOnLoad(gameObject);
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     gameObject.SetActive(true);
 }
Example #13
0
    // Start is called before the first frame update
    void Start()
    {
        Doom_Shroom_St = GetComponent <Doom_Shroom_State>();
        Doom_Shroom_An = GetComponent <Doom_Shroom_Animation>();
        HUD            = Doom_Shroom_St.HUD;
        switch (Global_Variable.Difficulty_Level)
        {
        case 2:
            Max_Health = Health_Hard;
            break;

        case 1:
            Max_Health = Health_Normal;
            break;

        default:
            Max_Health = Health_Easy;
            break;
        }
        Current_Health = Max_Health;
    }
    // Start is called before the first frame update
    void Start()
    {
        Store_Janitor_An = GetComponent <Store_Janitor_Animation>();
        Store_Janitor_St = GetComponent <Store_Janitor_States>();
        Store_Janitor_At = GetComponent <Store_Janitor_Attack>();
        HUD = Store_Janitor_St.HUD;
        switch (Global_Variable.Difficulty_Level)
        {
        case 2:
            Max_Health = Health_Hard;
            break;

        case 1:
            Max_Health = Health_Normal;
            break;

        default:
            Max_Health = Health_Easy;
            break;
        }
        Current_Health = Max_Health;
    }
Example #15
0
    // Start is called before the first frame update
    void Start()
    {
        Electricity_Manager_An = GetComponent <Electricity_Manager_Animation>();
        Electricity_Manager_St = GetComponent <Electricity_Manager_State>();


        HUD = Electricity_Manager_St.HUD;
        switch (Global_Variable.Difficulty_Level)
        {
        case 2:
            Max_Health = Health_Hard;
            break;

        case 1:
            Max_Health = Health_Normal;
            break;

        default:
            Max_Health = Health_Easy;
            break;
        }
        Current_Health = Max_Health;
    }
Example #16
0
 // Use this for initialization
 void Start()
 {
     hudmanager = GameObject.FindGameObjectWithTag("Player").GetComponent <HUD_Manager>();
 }
 void OnEnable()
 {
     SetPlayerNameOnUnitFrame();
     hudManager = this;
 }
Example #18
0
 // Use this for initialization
 void Start()
 {
     HUD_Manager = GameObject.Find("Player").GetComponent <HUD_Manager> ();
 }
Example #19
0
    void Awake()
    {
        // get references
        main = this;
        myTransform = transform;
        myAnimator = GetComponent<Animator>();
        myCamera = GameObject.Find("Gemini Camera").transform.Find("Camera").camera;
        myCameraTransform = GameObject.Find("Gemini Camera").transform;
        ScoreManager = GetComponent<Score_Manager>();
        myHUD = myCameraTransform.GetComponent<HUD_Manager>();
        myAlign = GetComponent<PlanetAlign>();

        // settings
        joystickBitMask = 1<<LayerMask.NameToLayer("Joystick");
        joystickCenter = myCamera.WorldToScreenPoint(GameObject.Find("Joystick").transform.position);

        // set up
        CreateCombos();
        Texture[][] cosmicTextures = new Texture[3][];
        cosmicTextures[0] = cosmicPower1;
        cosmicTextures[1] = cosmicPower2;
        cosmicTextures[2] = cosmicPower3;
        AttackMeter = new AttackMeter_Manager(this, cosmicButton, cosmicTextures, new int[] {50, 100, 150}, new string[] {"SpeedBoost", "KillAll", "HealthBoost"});
    }