mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-10-19 20:16:04 -04:00
20 lines
465 B
C#
20 lines
465 B
C#
using System;
|
|
using OpenTK;
|
|
|
|
namespace ClassicalSharp.Entities {
|
|
|
|
public sealed class FleeAI : AI {
|
|
|
|
public FleeAI( Game game, Entity entity ) : base( game, entity ) { }
|
|
|
|
public override void Tick( Entity target ) {
|
|
MoveRandomly( entity );
|
|
}
|
|
|
|
public override void AttackedBy( Entity source ) {
|
|
Vector3 fleeDir = -Vector3.Normalize( source.Position - entity.Position );
|
|
MoveInDirection( source, fleeDir * 5 );
|
|
}
|
|
}
|
|
}
|