private void Start()
 {
     agent       = GetComponent <NavMeshAgent>();
     agent.speed = AISpeed;
     player      = GameObject.FindGameObjectWithTag("Player").transform;
     anim        = GetComponentInChildren <Animator>();
     healthBar   = FindObjectOfType <UI_Script>();
 }
Esempio n. 2
0
	    // make sure the constructor is private, so it can only be instantiated here
	    public GameModel() {
			this.p1 = new Player(1);
			this.p2 = new Player(2);
			this.players = new Player[] { p1, p2 };
			this.camera = new FightCamera( p1, p2 );
			this.ui = GameObject.Find("UI").GetComponent<UI_Script>();
			this.leftBoundary = camera.leftBoundary;
			this.rightBoundary = camera.rightBoundary;
	    }
Esempio n. 3
0
 public void onTakeDamage(float damage)
 {
     health -= damage;
     if (health <= 0)
     {
         playerStats = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <UI_Script>();
         playerStats.setMoney(100);
         Destroy(gameObject);
     }
 }
Esempio n. 4
0
    void Start()
    {
        player      = GameObject.FindGameObjectWithTag("Player").transform;
        playerStats = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <UI_Script>();

        target = new Vector3(player.position.x, player.position.y, player.position.z);
        transform.LookAt(player);
        transform.rotation *= Quaternion.Euler(90, 0, 0);
        distance            = Vector3.Distance(target, transform.position);
    }
Esempio n. 5
0
 //use this for init
 void Start()
 {
     Logo.SetActive(true);
     PlayButton.SetActive(true);
     QuitButton.SetActive(true);
     GameOver.SetActive(false);
     Instance         = this;
     YouWin.enabled   = false;
     BallNum_orig     = BallNum;
     BallNumText.text = "Ball Left: " + BallNum;
 }
Esempio n. 6
0
 private void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else
     {
         Destroy(this);
     }
 }
Esempio n. 7
0
 public void Awake()
 {
     if (instance != null && instance != this)
     {
         Destroy(this.gameObject);
     }
     else
     {
         instance = this;
     }
 }
Esempio n. 8
0
 void OnTriggerEnter2D(Collider2D obj)
 {
     if (obj.tag == "Key")
     {
         Destroy(obj.gameObject);
     }
     else if (obj.tag == "End" && UI_Script.keysLeft() == 0)
     {
         if (SceneManager.GetActiveScene().buildIndex != 16)
         {
             SceneManager.LoadScene(SceneManager.GetActiveScene().buildIndex + 1);
         }
         else
         {
         }
     }
 }
Esempio n. 9
0
    private float flo_High           = 15.0f;               //最大長度

    public void Awake()
    {
        UseUiScript        = GameObject.FindObjectOfType <UI_Script>();
        Rigidbody2D_Player = this.GetComponent <Rigidbody2D>();

        Obj_Wifi[0] = GameObject.Find("Wifi");                     //Wifi訊號位置
        Obj_Wifi[1] = GameObject.Find("Loading");                  //判斷是否可以顯示地圖
        Obj_Wifi[2] = GameObject.Find("WifiSignal3");              //Wifi訊號滿格
        Obj_Wifi[3] = GameObject.Find("WifiSignal2");              //Wifi訊號三格
        Obj_Wifi[4] = GameObject.Find("WifiSignal1");              //Wifi訊號兩格
        Obj_Wifi[5] = GameObject.Find("WifiSignalDot");            //Wifi訊號一格

        Obj_WifiEffect = GameObject.Find("WifiOK");                //Wifi載入的特效物件

        Obj_Exit = GameObject.Find("UI_Win");                      //抓取出口的物件
        Obj_Exit.SetActive(false);                                 //出口關閉

        Obj_ScreenOver[0] = GameObject.Find("UI_Camera_Lose");     //遊戲失敗UI畫面
        Obj_ScreenOver[0].SetActive(false);                        //暫時關閉遊戲失敗UI

        Obj_ScreenOver[1] = GameObject.Find("UI_Camera_Win");      //遊戲成功UI畫面
        Obj_ScreenOver[1].GetComponent <Canvas>().enabled = false; //暫時關閉遊戲成功UI
        Obj_ScreenOver[1].transform.GetChild(0).gameObject.SetActive(false);
    }
Esempio n. 10
0
    // Start is called before the first frame update
    void Start()
    {
        spiderRef = GameObject.Find("spiderJana");
        ui        = uiRef.GetComponent <UI_Script>();
        spider    = spiderRef.GetComponent <Player>();
        SetRatio(9, 16);

        sounds = GetComponents <AudioSource>();
        a1     = sounds[0];
        a2     = sounds[1];
        a3     = sounds[2];
        a4     = sounds[3];
        a5     = sounds[4];
        a6     = sounds[5];
        a7     = sounds[6];
        a8     = sounds[7];
        a9     = sounds[8];
        a10    = sounds[9];
        a11    = sounds[10];
        a12    = sounds[11];
        a13    = sounds[12];
        a14    = sounds[13];
        a15    = sounds[14];
    }
Esempio n. 11
0
 // Start is called before the first frame update
 void Start()
 {
     m_ui = m_test.GetComponent <UI_Script>();
 }
Esempio n. 12
0
 public void Start()
 {
     playerStats = GameObject.FindGameObjectWithTag("HealthBar").GetComponent <UI_Script>();
     end         = GameObject.FindGameObjectWithTag("Ending").GetComponent <Ending>();
 }