예제 #1
0
 private void OnTriggerEnter2D(Collider2D other)
 {
     if (other.tag == "Player")
     {
         hudd = GameObject.Find("Main Camera").GetComponent <HUDscript>();
         hudd.increaseScore(10);
         Destroy(this.gameObject);
     }
 }
예제 #2
0
 void OnTriggerEnter2D(Collider2D other)                                  //method for collision detection
 {
     if (other.tag == "Player")                                           //if the player collides with the object
     {
         hud = GameObject.Find("Main Camera").GetComponent <HUDscript>(); //find the hudscript in the 'main camera' object
         hud.IncreaseScore(10);                                           //increase the score
         Destroy(this.gameObject);                                        //destroy this object
     }
 }
예제 #3
0
 void OnTriggerEnter2D(Collider2D other)//method for collision detection
 {
     if (other.tag == "Player")//if the player collides with the object
     {
         hud = GameObject.Find("Main Camera").GetComponent<HUDscript>();//find the hudscript in the 'main camera' object
         hud.IncreaseScore(10);//increase the score
         Destroy (this.gameObject);//destroy this object
     }
 }
예제 #4
0
    void OnTriggerEnter2D(Collider2D other)
    {
        if (other.tag == "Player")
        {
            hud = GameObject.Find("Main Camera").GetComponent <HUDscript>();
            hud.IncreaseScore(10);
            gameObject.GetComponent <SpriteRenderer>().enabled = false;
            Destroy(this.gameObject, 3f);

            if (Settings.MusicSettings.IsMusicOn)
            {
                gameObject.GetComponent <AudioSource>().Play();
            }
        }
    }
 // Start is called before the first frame update
 void Start()
 {
     totstates     = NrOfFeatures * NrOfFeatures;
     playerinfo    = GameObject.FindGameObjectWithTag("MainCamera").GetComponent <HUDscript>();
     playercontrol = GetComponent <Platformer2DUserControl>();
     mychar        = GetComponent <PlatformerCharacter2D>();
     CreatenewAgent();
     //curr_agent = this;
     testint    = 0;
     hasbeenhit = false;
     realplayer = GameObject.FindGameObjectWithTag("Player");
     myagents   = new List <Agent>();
     canjump    = true;
     //Mathf.Pow(NrOfFeatures, 2);
 }
예제 #6
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (isColliding)
        {
            return;
        }
        if (collision.tag == "Player")
        {
            isColliding = true;

            hud = GameObject.Find("Main Camera").GetComponent <HUDscript>();

            Destroy(this.gameObject);

            hud.changeMoney(50);
        }
    }
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (isColliding)
        {
            return;
        }

        if (collision.tag == "Player")
        {
            isColliding = true;
            hud         = GameObject.Find("Main Camera").GetComponent <HUDscript>();

            Destroy(this.gameObject);
            //Destroy(collision.gameObject);
            collision.GetComponent <Agent>().hasbeenhit = true;
            hud.changeHealth(-10);
        }
    }
 void Awake()
 {
     thisHUD = this;
 }
 static void createHUD()
 {
     GameObject g = Instantiate(Resources.Load("HUD")) as GameObject;
     thisHUD = g.GetComponent<HUDscript>();
     thisHUD.text = g.GetComponentInChildren<Text>();
 }