Exemple #1
0
    //method to move the entity
    protected override void Move()
    {
        // the boss in tank mode does not move
        if (em == EnemyMode.Tank)
        {
        }

        // the boss will have the same movement as a forward enemy
        if (em == EnemyMode.Forward)
        {
            if (Vector3.Dot(steering.player.transform.position, transform.right) > 0)
            {
                facingLeft = true;
                force     += steering.Arrival(steering.player.transform.position, velocity, speed) * 300f;
            }
            else
            {
                facingLeft = false;
                force     += steering.Arrival(steering.player.transform.position, velocity, speed) * 300f;
            }
            force = Vector3.ClampMagnitude(force, 300f);
            steering.ApplyForce(force);
            steering.UpdatePosition(velocity, direction);
            steering.SetTransform(direction);
        }
    }
Exemple #2
0
 //method to move the entity using steering forces
 protected override void Move()
 {
     force += steering.WanderCircle(velocity, speed) * 50f;
     force  = Vector3.ClampMagnitude(force, 200f);
     steering.ApplyForce(force);
     steering.UpdatePosition(velocity, direction);
     steering.SetTransform(direction);
 }
 //method to move the entity using steering forces
 protected override void Move()
 {
     // determine which side of the player the sprite is currently at by checking the dot product
     if (Vector3.Dot(steering.player.transform.position, transform.right) > 0)
     {
         facingLeft = true;
         force     += steering.Arrival(steering.player.transform.position, velocity, speed) * 700f;
     }
     else
     {
         facingLeft = false;
         force     += steering.Arrival(steering.player.transform.position, velocity, speed) * 700f;
     }
     force = Vector3.ClampMagnitude(force, 400f);
     steering.ApplyForce(force);
     steering.UpdatePosition(velocity, direction);
     steering.SetTransform(direction);
 }