コード例 #1
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        if (GameManager.player == null)
        {
            Executing = false;
            return;
        }

        entity.StopMoving();
        entity.lookPos = GameManager.player.transform.position;

        if (entity.currentWeapon.attacking)
        {
            return;
        }

        if (entity.currentWeapon.CanSecondaryAttack())
        {
            entity.SecondaryAttack();
        }
        else
        {
            entity.Attack();
        }

        if (!enemyAI.CanAttackTarget())
        {
            entity.lookingAt = false;
            Executing        = false;
        }
    }
コード例 #2
0
 public void beginSummon(SummonerAttackState _summoner, AbstractEnemyAI _enemyToSummon)
 {
     enemyToSummon = _enemyToSummon;
     summoner      = _summoner;
     animator      = GetComponent <Animator>();
     animator.SetTrigger("BeginSummon");
 }
コード例 #3
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        if (enemyAI.reachedEndOfPath || enemyAI.canSeePlayer)
        {
            Executing = false;
        }

        enemyAI.AstarMoveToTarget();
    }
コード例 #4
0
    void OnTriggerEnter(Collider coll)
    {
        IAggroable      aggroable = coll.GetComponentInParent <IAggroable>();
        AbstractEnemyAI ai        = aggroable as AbstractEnemyAI;

        if (aggroable != null)
        {
            Assert.IsNotNull(ai);
            AbstractEnemyAI.AIState newState = new AbstractEnemyAI.SeekingAggroAIState(ai, this);
            aggroable.pushNewState(newState);
        }
    }
コード例 #5
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        entity.StopMoving();

        if (enemySpawned && spawnCount <= numEnemiesToSpawn)
        {
            var summon = Instantiate(summoningController, enemyAI.GetCurrentRoom().GetRandomPointInRoom(2, 2), Quaternion.identity);
            entity.lookPos = summon.transform.position;

            summon.beginSummon(this, enemyPrefab);
            enemySpawned = false;
        }
    }
コード例 #6
0
    public override void execute(AbstractEnemyAI enemyAI)
    {
        if (Executing && !conditionsMet(enemyAI))
        {
            Executing = false;
        }

        enemyAI.AstarMoveToTarget();

        if (enemyAI.reachedEndOfPath)
        {
            enemyAI.targetPosition = currentRoom.GetRandomPointInRoom(0, 0);
        }
    }
コード例 #7
0
    public override bool conditionsMet(AbstractEnemyAI enemyAI)
    {
        if (enemyAI.currentState.Name == "Patrol" && !enemyAI.canSeePlayer)
        {
            if (!enemyAI.reachedEndOfPath)
            {
                return(true);
            }
        }
        else if (enemyAI.currentState.Name == "Idle" && !enemyAI.canSeePlayer)
        {
            IdleState idleState = (IdleState)enemyAI.currentState;

            if (idleState.timeIdle > patrolInterval)
            {
                return(true);
            }
        }

        return(false);
    }
コード例 #8
0
ファイル: ChaseState.cs プロジェクト: Blukzen/Dungrena
    public override void execute(AbstractEnemyAI enemyAI)
    {
        // If can see player update path to player and move towards.
        if (enemyAI.canSeePlayer && !enemyAI.CanAttackTarget())
        {
            if (GameManager.player == null)
            {
                return;
            }

            enemyAI.targetPosition = GameManager.player.transform.position;

            enemyAI.AstarMoveToTarget();
        }

        // If reached end of path and cannot see player stop executing ChaseState.
        else
        {
            enemyAI.targetPosition = transform.position;
            Executing = false;
        }
    }
コード例 #9
0
ファイル: DashAttackState.cs プロジェクト: Blukzen/Dungrena
    public override void execute(AbstractEnemyAI enemyAI)
    {
        // If dashing check if we have travelled the dash distance and stop.
        if (Vector2.Distance(startPos, transform.position) >= DashDistance && dashing && Executing)
        {
            OnFinishDash();
        }

        // If already dashing dont dash again
        if (dashing || chargingDash)
        {
            return;
        }

        if (caster == null)
        {
            return;
        }

        lastCastTime = Time.time;

        // Target wasnt set
        if (target == Vector2.zero)
        {
            Debug.Log("[" + caster.name + "] " + "DashAbility target was not set");
        }

        UpdateDirection();

        // Disable friction and movement
        caster.canMove       = false;
        caster.applyFriction = false;
        caster.ResetVelocity();
        caster.AddVelocity(direction, DashSpeed);

        dashing = true;
    }
コード例 #10
0
 public SeekingAggroAIState(AbstractEnemyAI stateMachine, Aggro target)
     : base(stateMachine)
 {
     stateMachine.navigation.SeekQueen();
     this.target = target;
 }
コード例 #11
0
 public override bool conditionsMet(AbstractEnemyAI enemyAI)
 {
     return(canCast() && enemyAI.canSeePlayer);
 }
コード例 #12
0
 public IdleState(AbstractEnemyAI stateMachine) : base(stateMachine)
 {
     stateMachine.navigation.ClearSeeking();
 }
コード例 #13
0
 public abstract void execute(AbstractEnemyAI enemyAI);
コード例 #14
0
 public abstract bool conditionsMet(AbstractEnemyAI enemyAI);
コード例 #15
0
 protected virtual void Awake()
 {
     enemyAI = GetComponent <AbstractEnemyAI>();
     entity  = GetComponent <AbstractEnemy>();
 }
コード例 #16
0
 public override void execute(AbstractEnemyAI enemyAI)
 {
     timeIdle += Time.deltaTime;
     entity.StopMoving();
 }
コード例 #17
0
 public AtomicAIState(AbstractEnemyAI stateMachine) : base(stateMachine)
 {
 }
コード例 #18
0
 public void summonEnemy()
 {
     enemySummoned = Instantiate(enemyToSummon, GameManager.dungeonGenerator.Enemies.transform);
     enemySummoned.transform.position = this.transform.position;
     enemySummoned.enabled            = false;
 }
コード例 #19
0
 public override void execute(AbstractEnemyAI enemyAI)
 {
     throw new System.NotImplementedException();
 }
コード例 #20
0
 public SeekingPlayerAIState(AbstractEnemyAI stateMachine)
     : base(stateMachine)
 {
     stateMachine.navigation.SeekPlayer();
     aggroLossTime = Time.time + stateMachine.aiParameters.aggroTime;
 }
コード例 #21
0
 public override bool conditionsMet(AbstractEnemyAI enemyAI)
 {
     // Dont idle if we can see player
     return(!enemyAI.canSeePlayer);
 }
コード例 #22
0
ファイル: ChaseState.cs プロジェクト: Blukzen/Dungrena
 public override bool conditionsMet(AbstractEnemyAI enemyAI)
 {
     return(enemyAI.canSeePlayer && !enemyAI.CanAttackTarget());
 }
コード例 #23
0
 public AIState(AbstractEnemyAI stateMachine)
 {
     this.stateMachine = stateMachine;
 }
コード例 #24
0
ファイル: WeaponAttackState.cs プロジェクト: Blukzen/Dungrena
 public override void execute(AbstractEnemyAI enemyAI)
 {
     enemyAI.Attack();
     Executing = false;
 }
コード例 #25
0
 public SeekingQueenAIState(AbstractEnemyAI stateMachine)
     : base(stateMachine)
 {
     stateMachine.navigation.SeekQueen();
 }
コード例 #26
0
 public override bool conditionsMet(AbstractEnemyAI enemyAI)
 {
     throw new System.NotImplementedException();
 }
コード例 #27
0
ファイル: DashAttackState.cs プロジェクト: Blukzen/Dungrena
 public override bool conditionsMet(AbstractEnemyAI enemyAI)
 {
     target = GameManager.player == null ? transform.position : GameManager.player.transform.position;
     return(canCast() && TargetInRange() && enemyAI.canSeePlayer);
 }