Exemple #1
0
        public static void Next(Monster monster)
        {
            int rand = Game.Random.Next(1, 5);

            switch (rand)
            {
            case 1:
            case 2:
            {
                GoldPile.DropGold(monster);
                return;
            }

            case 3:
            case 4:
            {
                ItemPassive.RandomDrop(monster);
                return;
            }

            case 5:
            {
                ItemActive.RandomDrop(monster);
                return;
            }
            }
        }
Exemple #2
0
    // Use this for initialization
    void Awake()
    {
        rb        = GetComponent <Rigidbody>();
        bloodAnim = gameObject.transform.GetChild(0).GetChild(0).GetComponent <Animator>();
        anim      = GetComponent <Animator>();
        agent     = GetComponent <NavMeshAgent>();
        //capsuleCollider = GetComponent<CapsuleCollider>();
        goldPile = GameObject.Find("GoldPile");
        if (goldPile)
        {
            gold = goldPile.GetComponent <GoldPile>();
        }
        currentHealth = startingHealth;

        //Audio
        enemySound = GetComponent <AudioSource>();
    }
        // Return true when able to place the actor on the cell
        public bool SetActorPostion(Actor actor, int x, int y)
        {
            if (GetCell(x, y).IsWalkable)
            {
                SetIsWalkable(actor.X, actor.Y, true);
                UpdateActorPosition(actor, x, y);
                SetIsWalkable(actor.X, actor.Y, false);
                OpenDoor(actor, x, y);

                if (actor is Player)
                {
                    UpdatePlayerFieldOfView();
                    Item.SearchForItems();
                    GoldPile.SearchForGold();
                }
                return(true);
            }
            return(false);
        }