Inheritance: MonoBehaviour
コード例 #1
0
 public override void SceneLoadLocalDone(string map)
 {
     if (map == "Game")
     {
         WorldItemManager = GameObject.Find("GameManager").GetComponent <WorldItemManager>();
     }
 }
コード例 #2
0
ファイル: AmountPanel.cs プロジェクト: alvinman/defendaman
    void Start () {
        _world_item_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<WorldItemManager>();
        _amount_panel = GameObject.Find("Amount Panel");
        _amt_input_field = GameObject.Find("Amount InputField");
        _error_text = _amount_panel.transform.Find("Error Text").GetComponent<Text>();
        _amount_panel.SetActive(false);
	}
コード例 #3
0
 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 WorldItemManager. 
     DontDestroyOnLoad(gameObject);      //Sets this to not be destroyed when reloading scene
 }
コード例 #4
0
 /*---------------------------------------------------------------------------
 -- FUNCTION: 	Awake
 -- DATE: 		15/03/2016
 -- REVISIONS: 	
 -- DESIGNER:  	Joseph Tam-Huang
 -- PROGRAMMER: 	Joseph Tam-Huang
 -- INTERFACE: 	void Awake()
 -- RETURNS: 	void
 -- NOTES:
 -- Called once during the lifetime of the script, create one and only one
 -- instance of the WorldItemManager. Enforces the singleton pattern.
 -----------------------------------------------------------------------------*/
 void Awake()
 {
     if (Instance == null)               
         Instance = this;                
     else if (Instance != this)          
         Destroy(gameObject);             
     DontDestroyOnLoad(gameObject);      
 }
コード例 #5
0
 /*---------------------------------------------------------------------------------------
  * -- FUNCTION:     Start
  * -- DATE:         10/03/2016
  * -- REVISIONS:
  * -- DESIGNER:     Joseph Tam-Huang
  * -- PROGRAMMER:   Joseph Tam-Huang
  * -- INTERFACE:    void Start()
  * -- RETURNS:  void
  * -- NOTES:
  * -- Retrieves the WorldItemManager script, the AmountPanel GameObject, the Amount
  * -- InputField GameObject and the Error Text object.
  * -- Deactivates the AmountPanel GameObject.
  * ----------------------------------------------------------------------------------------*/
 void Start()
 {
     _world_item_manager =
         GameObject.FindGameObjectWithTag("GameManager").GetComponent <WorldItemManager>();
     _amount_panel    = GameObject.Find("Amount Panel");
     _amt_input_field = GameObject.Find("Amount InputField");
     _error_text      = _amount_panel.transform.Find("Error Text").GetComponent <Text>();
     _amount_panel.SetActive(false);
 }
コード例 #6
0
ファイル: WorldItemData.cs プロジェクト: alvinman/defendaman
	/*
     * Retrieve the player id
     */
	void Start()
	{
		gameObject.layer = LayerMask.NameToLayer("HiddenThings");
		gameObject.transform.Translate(0, 0, 9);
		// set material to stencil masked
		gameObject.GetComponent<SpriteRenderer>().material = (Material)Resources.Load("Stencil_01_Diffuse Sprite", typeof(Material));
		_player_id = GameData.MyPlayer.PlayerID;
		_world_item_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<WorldItemManager>();
		_tooltip = GameObject.Find("Inventory").GetComponent<Tooltip>();
	}
コード例 #7
0
ファイル: ItemMenu.cs プロジェクト: alvinman/defendaman
    /*
     * Retrieves the ItemMenu game object and sets it to inactive.
     * Retrieves the WorldItemManager script.
     */
    void Start ()
    {
        _item_menu = GameObject.Find("Item Menu"); 
        _item_menu.SetActive(false);
		_world_item_manager = GameObject.FindGameObjectWithTag("GameManager").GetComponent<WorldItemManager>();
        _amount_panel = GameObject.Find("Inventory").GetComponent<AmountPanel>();
        _use_btn = _item_menu.transform.FindChild("Use Button").gameObject;
        _item_menu_rt = _item_menu.GetComponent<RectTransform>();
        _item_menu_height = _item_menu_rt.rect.height;
    }
コード例 #8
0
ファイル: ItemMenu.cs プロジェクト: okwan/defendaman
 /*---------------------------------------------------------------------------------------
  * -- FUNCTION:     Start
  * -- DATE:         05/03/2016
  * -- REVISIONS:
  * -- DESIGNER:     Joseph Tam-Huang
  * -- PROGRAMMER:   Joseph Tam-Huang
  * -- INTERFACE:    void Start()
  * -- RETURNS:  void
  * -- NOTES:
  * -- Retrieves the ItemMenu game object and sets it to inactive.
  * -- Retrieves the WorldItemManager script.
  * ----------------------------------------------------------------------------------------*/
 void Start()
 {
     _item_menu = GameObject.Find("Item Menu");
     _item_menu.SetActive(false);
     _world_item_manager =
         GameObject.FindGameObjectWithTag("GameManager").GetComponent <WorldItemManager>();
     _amount_panel     = GameObject.Find("Inventory").GetComponent <AmountPanel>();
     _use_btn          = _item_menu.transform.FindChild("Use Button").gameObject;
     _item_menu_rt     = _item_menu.GetComponent <RectTransform>();
     _item_menu_height = _item_menu_rt.rect.height;
 }
コード例 #9
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
コード例 #10
0
 private void Awake()
 {
     if (instance == null || instance == this)
     {
         instance = this;
     }
     else
     {
         UnityEngine.Debug.LogWarning("Removed a second instance of WorldItemManager");
         Destroy(this);
     }
 }
コード例 #11
0
ファイル: WorldItemData.cs プロジェクト: okwan/defendaman
 /*---------------------------------------------------------------------------------------
  * -- FUNCTION:     Start
  * -- DATE:         05/03/2016
  * -- REVISIONS:
  * -- DESIGNER:     Joseph Tam-Huang
  * -- PROGRAMMER:   Joseph Tam-Huang
  * -- INTERFACE:    void Start()
  * -- RETURNS:  void
  * -- NOTES:
  * -- Retrieves the HiddenThings layer mask.
  * -- Retrieves the WorldItemManager script.
  * -- Retrieves the Tooltip GameObject.
  * ----------------------------------------------------------------------------------------*/
 void Start()
 {
     gameObject.layer = LayerMask.NameToLayer("HiddenThings");
     gameObject.transform.Translate(0, 0, 9);
     // set material to stencil masked
     gameObject.GetComponent <SpriteRenderer>().material =
         (Material)Resources.Load("Stencil_01_Diffuse Sprite", typeof(Material));
     _player_id          = GameData.MyPlayer.PlayerID;
     _world_item_manager =
         GameObject.FindGameObjectWithTag("GameManager").GetComponent <WorldItemManager>();
     _tooltip = GameObject.Find("Inventory").GetComponent <Tooltip>();
 }
コード例 #12
0
ファイル: WorldItemManager.cs プロジェクト: okwan/defendaman
 /*---------------------------------------------------------------------------
  * -- FUNCTION:     Awake
  * -- DATE:         15/03/2016
  * -- REVISIONS:
  * -- DESIGNER:     Joseph Tam-Huang
  * -- PROGRAMMER:   Joseph Tam-Huang
  * -- INTERFACE:    void Awake()
  * -- RETURNS:  void
  * -- NOTES:
  * -- Called once during the lifetime of the script, create one and only one
  * -- instance of the WorldItemManager. Enforces the singleton pattern.
  * -----------------------------------------------------------------------------*/
 void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
     }
     else if (Instance != this)
     {
         Destroy(gameObject);
     }
     DontDestroyOnLoad(gameObject);
 }