Esempio n. 1
0
    // Use this for initialization
    void Start()
    {
        random = Random.Range(1,9);

        _health = 50;
        _attack = 20;
        _moving = true;
        _pathNode = GameObject.Find("PathNode_" + random);
        _sheep = GameObject.Find("Sheep_" + random);
        _wall = GameObject.Find("wall" + random);
        wall = _wall.gameObject.GetComponent<Wall_Destruct>();
        _speed = Random.Range(speedMin,speedMax);
        target = _pathNode.gameObject;

        if (wall.WallCount < 8)
        {
            do
            {
                _wall = GameObject.Find("wall" + Random.Range(1,9));

            }while (_wall.renderer.enabled);

            do
            {
                _sheep = GameObject.Find("Sheep_" + Random.Range(1,9));
            }while (!_sheep);

        }
    }
Esempio n. 2
0
    void OnTriggerEnter(Collider other)
    {
        if (other.tag == "wall")
        {
            wall = other.GetComponent<Wall_Destruct>();
            if (wall.transform.renderer.enabled == true)
            {
                wall.stoneOnce = false;
                wall.woodOnce = false;
                wall.strawOnce = false;
                AudioSource.PlayClipAtPoint(wall.rebuildSound, transform.position);
                GameObject newRebuild = (GameObject)Instantiate(wall.rebuild);
                newRebuild.transform.position = transform.position;
                Destroy(newRebuild,5.0f);
          	 	wall.Rebuild();
            }
            else if (wall.transform.renderer.enabled == false)
            {
                wall.WallCount++;
                wall.renderer.enabled = true;
                wall.stoneOnce = false;
                wall.woodOnce = false;
                wall.strawOnce = false;
                AudioSource.PlayClipAtPoint(wall.rebuildSound, transform.position);
                GameObject newRebuild = (GameObject)Instantiate(wall.rebuild);
                newRebuild.transform.position = transform.position;
                Destroy(newRebuild,5.0f);
                wall.Rebuild();

            }

            Destroy(this.gameObject);
        }
    }
Esempio n. 3
0
 protected virtual void CheckAttack(float s_attack, Wall_Destruct s_wall)
 {
     s_wall.TakeDamage(s_attack);
 }
Esempio n. 4
0
 protected override void CheckAttack(float s_attack, Wall_Destruct s_wall)
 {
     base.CheckAttack (s_attack, s_wall);
 }