Ejemplo n.º 1
0
 // Update is called once per frame
 void Update()
 {
     attack_timer += Time.deltaTime;
     if (is_human_castle && !game_over && hit_points < 1)
     {
         game_over = true;
         Debug.Log("The Orc Team wins.");
         GetComponent <unit_sounds>().Play("Acknowledge");
         CircleCollider2D.Destroy(GetComponent <CircleCollider2D>());
         SpriteRenderer.Destroy(GetComponent <SpriteRenderer>());
         Invoke("Restart", 5);
     }
     if (is_orc_castle && !game_over && hit_points < 1)
     {
         game_over = true;
         Debug.Log("The Human Team wins.");
         GetComponent <unit_sounds>().Play("Acknowledge");
         CircleCollider2D.Destroy(GetComponent <CircleCollider2D>());
         SpriteRenderer.Destroy(GetComponent <SpriteRenderer>());
         Invoke("Restart", 5);
     }
     if ((is_human_castle || is_orc_castle) && game_over)
     {
         return;
     }
     if (hit_points < 1 && dead == false)
     {
         dead   = true;
         attack = 0;
         footman_ex01 footman = GetComponent <footman_ex01>();
         if (footman)
         {
             footman.dead = true;
         }
         Rigidbody2D body = GetComponent <Rigidbody2D>();
         if (body)
         {
             Rigidbody2D.Destroy(body);
         }
         unit_sounds sounds = GetComponent <unit_sounds>();
         if (sounds)
         {
             sounds.Play("Dead");
         }
         Animator animator = GetComponent <Animator>();
         if (animator)
         {
             animator.SetTrigger("Dead");
         }
         if (sounds || animator)
         {
             Invoke("Kill", 2.5f);
         }
         else
         {
             Kill();
         }
     }
 }
Ejemplo n.º 2
0
    void OnCollisionEnter2D(Collision2D coll)
    {
        entity_ex03  enemy   = coll.gameObject.GetComponent <entity_ex03>();
        footman_ex01 footman = GetComponent <footman_ex01>();
        orc_ex02     orc     = GetComponent <orc_ex02>();

        if (footman && enemy && enemy.alliance != alliance)
        {
            footman.target_entity = enemy;
        }
        if (orc && enemy && enemy.alliance != alliance)
        {
            orc.target_entity = enemy;
        }
    }
Ejemplo n.º 3
0
 public bool isDead(footman_ex01 footman)
 {
     return(footman == null);
 }
Ejemplo n.º 4
0
 public void AddToHitList(footman_ex01 footman)
 {
     hitlist.Add(footman);
 }
Ejemplo n.º 5
0
 public void Add(footman_ex01 orc)
 {
     orcs_all.Add(orc);
 }
Ejemplo n.º 6
0
 public void Add(footman_ex01 footman)
 {
     footmen_all.Add(footman);
 }