Beispiel #1
0
 void executePlayerAttackLeftLight()
 {
     if (facingRight == false)
     {
         foreach (GameObject enemy in RangeCheck.enemiesInRange)
         {
             if (enemy.transform.position.x <= this.gameObject.transform.position.x)
             {
                 Debug.Log(enemy + " was damaged");
                 enemyScript = enemy.GetComponent <MobHandler> ();
                 executeDamageOutput();
             }
         }
     }
     else
     {
         foreach (GameObject enemy in RangeCheck.enemiesInRange)
         {
             if (enemy.transform.position.x >= this.gameObject.transform.position.x)
             {
                 Debug.Log(enemy + " was damaged");
                 enemyScript = enemy.GetComponent <MobHandler> ();
                 executeDamageOutput();
             }
         }
     }
 }
 public void BuildingTakeDamage(MobHandler MH)
 {
     if (MH)
     {
         _health.TakeDamage(MH.gameObject, MH.Damage);
         Debug.Log(_health.CurrentHealth);
         Debug.Log(_health.MaxHealth);
         var p = (float)_health.CurrentHealth / _health.MaxHealth;
         Debug.Log(p);
         _renderer.material.SetFloat("_Health", p);
         MH.RemoveMob();
     }
 }
Beispiel #3
0
    void Awake()
    {
        var loadMobs = Resources.LoadAll("Mobs", typeof(GameObject));

        foreach (GameObject obj in loadMobs)
        {
            MobHandler mh = obj.GetComponent <MobHandler>();
            AllMobs[mh.MobId] = mh;
        }

        RoundMobs[1]    = new Dictionary <int, int>();
        RoundMobs[1][1] = 5; //Round 1, Mob ID 1, Quantity 5
        RoundMobs[1][2] = 5;

        RoundMobs[2]    = new Dictionary <int, int>();
        RoundMobs[2][1] = 7; //Round 2, Mob ID 1, Quantity 7
        RoundMobs[2][2] = 10;

        RoundMobs[3]    = new Dictionary <int, int>();
        RoundMobs[3][1] = 12; //Round 3, Mob ID 1, Quantity 12
        RoundMobs[3][2] = 13;
        Debug.Log(RoundMobs[1].Count);
        Loaded = true;
    }
Beispiel #4
0
 // Use this for initialization
 void Start()
 {
     healthImage   = GetComponent <Image> ();
     handlerScript = this.transform.parent.gameObject.transform.parent.gameObject.GetComponent <MobHandler>();
 }
	void executePlayerAttackLeftLight()
	{
		if (facingRight == false) {
			foreach (GameObject enemy in RangeCheck.enemiesInRange) {
				if (enemy.transform.position.x <= this.gameObject.transform.position.x) {
					Debug.Log (enemy + " was damaged");
					enemyScript = enemy.GetComponent<MobHandler> ();
					executeDamageOutput ();
				}
			}
		}
		else
		{
			foreach (GameObject enemy in RangeCheck.enemiesInRange) {
				if (enemy.transform.position.x >= this.gameObject.transform.position.x) {
					Debug.Log (enemy + " was damaged");
					enemyScript = enemy.GetComponent<MobHandler> ();
					executeDamageOutput ();
				}
			}
		}
	}
	// Use this for initialization
	void Start ()
	{
		healthImage = GetComponent<Image> ();
		handlerScript = this.transform.parent.gameObject.transform.parent.gameObject.GetComponent<MobHandler>();
	}