public void ChaseAndBurstAttack()
    {
        //Replace this with pathfinding to the target
        Vector2 dir = (Target.Body.mAABB.Center - (Body.mAABB.Center + attackAnchor)).normalized;

        if (EnemyBehaviour.TargetInRange(this, Target, 124))
        {
            if (!mAttackManager.rangedAttacks[0].OnCooldown())
            {
                RangedAttack attack = mAttackManager.rangedAttacks[0];
                attack.Activate(dir, Position);
                mBossState = BossState.Aggrivated;
            }
        }
        else
        {
            Body.mSpeed = (Target.Position + new Vector2(32, 32) - Position).normalized * GetMovementSpeed();
        }

        if (dir.x < 0)
        {
            mDirection = EntityDirection.Right;
            //Body.mAABB.ScaleX = 1;
        }
        else
        {
            mDirection = EntityDirection.Left;
            //Body.mAABB.ScaleX = -1;
        }
    }
Esempio n. 2
0
    public override void OnDamagedTrigger(Attack attack)
    {
        base.OnDamagedTrigger(attack);

        if (Random.Range(0, 100) > procChance)
        {
            return;
        }

        rangedAttack = new RangedAttack(owner, attackPrototype);
        Vector2 tempDir = Vector2.up;

        if (attack.mEntity != null)
        {
            tempDir = attack.mEntity.Position - owner.Position;
        }

        rangedAttack.Activate(tempDir, owner.Position);
    }
Esempio n. 3
0
    public override void EntityUpdate()
    {
        mSummonTimer += Time.deltaTime;
        CheckForTargets();


        switch (mBossState)
        {
        case BossState.Idle:


            break;

        case BossState.Aggrivated:

            int random = Random.Range(0, 100);
            switch (random)
            {
            case int n when(n <= 50):
                mBossState = BossState.Attack1;

                break;

            case int n when(n > 50 && n <= 80):
                mBossState = BossState.Attack2;

                break;

            case int n when(n > 80):
                mBossState = BossState.Attack3;

                shotcount = 0;
                break;
            }

            if (Target != null)
            {
                Vector2 dir = ((Vector2)Target.Position - Position).normalized;

                if (!mAttackManager.rangedAttacks[0].OnCooldown())
                {
                    RangedAttack attack = mAttackManager.rangedAttacks[0];
                    attack.Activate(dir, Position);
                }

                Body.mSpeed = dir * GetMovementSpeed();
            }

            break;

        case BossState.Attack1:

            ShootLaser();
            break;

        case BossState.Attack2:

            SummonEyebat();
            break;

        case BossState.Attack3:

            BeamPillar();
            break;
        }

        if (Body.mSpeed.x > 0)
        {
            mDirection = EntityDirection.Right;
            //Body.mAABB.ScaleX = 1;
        }
        else
        {
            mDirection = EntityDirection.Left;
            //Body.mAABB.ScaleX = -1;
        }

        base.EntityUpdate();



        //HurtBox.mCollisions.Clear();
        //UpdatePhysics();

        //make sure the hitbox follows the object
    }
Esempio n. 4
0
    public override void EntityUpdate()
    {
        //This is just a test, probably dont need to do it this way

        EnemyBehaviour.CheckForTargets(this);


        switch (mEnemyState)
        {
        case EnemyState.Idle:

            break;

        case EnemyState.Moving:

            if (Target != null)
            {
                Renderer.SetAnimState("Eye_Fly");

                //Replace this with pathfinding to the target
                Vector2 dir = (Target.Body.mAABB.Center - (Body.mAABB.Center)).normalized;

                if (!mAttackManager.rangedAttacks[0].OnCooldown())
                {
                    RangedAttack attack = mAttackManager.rangedAttacks[0];
                    attack.Activate(dir, Position);
                }

                Body.mSpeed = ((Vector2)Target.Position - Position).normalized * GetMovementSpeed();

                if (Body.mPS.pushesLeftTile || Body.mPS.pushesRightTile)
                {
                    if (Target.Position.y < Position.y)
                    {
                        Body.mSpeed.y = -GetMovementSpeed();
                    }
                    else
                    {
                        Body.mSpeed.y = GetMovementSpeed();
                    }
                }
                else if (Body.mPS.pushesBottomTile || Body.mPS.pushesTopTile)
                {
                    if (Target.Position.x < Position.x)
                    {
                        Body.mSpeed.x = -GetMovementSpeed();
                    }
                    else
                    {
                        Body.mSpeed.x = GetMovementSpeed();
                    }
                }
            }
            else
            {
                if (!Body.mPS.pushesTop)
                {
                    Renderer.SetAnimState("Eye_Fly");
                    Body.mSpeed.y = GetMovementSpeed();
                }
                else
                {
                    Renderer.SetAnimState("Eye_Sleep");
                    Body.mSpeed.y = 0;
                }

                Body.mSpeed.x = 0;
            }

            break;
        }

        base.EntityUpdate();


        //HurtBox.mCollisions.Clear();
        //UpdatePhysics();

        //make sure the hitbox follows the object
    }