Beispiel #1
0
    // Use this for initialization
    new void Start()
    {
        enemyType   = EnemyType.getType(spawnID);
        attackTimer = 0.0f;
        //gm = FindObjectOfType<GameManager> ();
        //PathRequestManager.RequestPath(this, transform.position, target.transform.position, OnPathFound);
        pathFindTimer = pathRefreshTime;

        AttackCollider acLoad = Resources.Load("Attributes/AttackCollider", typeof(AttackCollider)) as AttackCollider;

        ac = (AttackCollider)Instantiate(acLoad);
        ac.setRadius(transform.GetComponent <CircleCollider2D>().radius);
        ac.owner              = this;
        ac.transform.parent   = transform;
        ac.transform.position = transform.position;

        stats = (AttributesZ)Instantiate(gm.AttributeZ);
        stats.setOwner(this);
        stats.mode = "Idle";

        //Add items to enemy Inventory
        enemyInventory = new Dictionary <string, int> ();
        enemyInventory.Add("cloth", 0);
        enemyInventory.Add("wood", 0);
        enemyInventory.Add("metal", 0);
        int clothNum = (int)Random.Range(0.0f, 3.0f);
        int woodNum  = (int)Random.Range(0.0f, 2.0f);
        int metalNum = (int)Random.Range(0.0f, 2.0f);

        enemyInventory ["cloth"] = clothNum;
        enemyInventory ["wood"]  = woodNum;
        enemyInventory ["metal"] = metalNum;
        //Debug.Log("EnemyInventory: " + "cloth: " + enemyInventory ["cloth"] + " | wood: " + enemyInventory ["wood"] + " | metal: " + enemyInventory ["metal"]);
        itemCloth = Resources.Load("Materials/cloth", typeof(Item)) as Item;
        itemWood  = Resources.Load("Materials/wood", typeof(Item)) as Item;
        itemMetal = Resources.Load("Materials/metal", typeof(Item)) as Item;
    }