示例#1
0
    public GameObject AcquireTarget(AttackPreference pref)
    {
        switch (pref)
        {
        case AttackPreference.Blacksmith:
            return(GameManager.Blacksmith);

        case AttackPreference.Library:
            return(GameManager.Library);

        case AttackPreference.Tavern:
            return(GameManager.Tavern);

        case AttackPreference.RandomPlayer:
            return(GameManager.RandomPlayer(this.gameObject));

        case AttackPreference.RandomVillager:
            return(GameManager.RandomVillager(this.gameObject, PerceptionRange));

        case AttackPreference.ClosestPlayer:
            return(GameManager.ClosestPlayer(this.gameObject));

        case AttackPreference.ClosestVillager:
            return(GameManager.ClosestVillager(this.gameObject));

        case AttackPreference.WeakestPlayer:
            return(GameManager.WeakestPlayer(this.gameObject));
        }
        return(null);
    }
示例#2
0
    // Use this for initialization
    void Start()
    {
        _samurai = GetComponent <Samurai>();
        _agent   = GetComponent <NavMeshAgent>();

        var possibleTypes = Enum.GetValues(typeof(EnemyType));

        _type = (EnemyType)possibleTypes.GetValue(UnityEngine.Random.Range(0, possibleTypes.Length));

        _currentAttackPreference = AttackPreference.RandomPlayer;
    }