mirror of
https://github.com/ClassiCube/ClassiCube.git
synced 2025-10-05 03:55:57 -04:00
25 lines
656 B
C#
25 lines
656 B
C#
// ClassicalSharp copyright 2014-2016 UnknownShadow200 | Licensed under MIT
|
|
using System;
|
|
using OpenTK;
|
|
|
|
namespace ClassicalSharp.Entities {
|
|
|
|
public sealed class HostileAI : AI {
|
|
|
|
public HostileAI( Game game, Entity entity ) : base( game, entity ) { }
|
|
|
|
public override void Tick( Entity target ) {
|
|
float distSq = (target.Position - entity.Position).LengthSquared;
|
|
if( distSq > 32 * 32 ) {
|
|
MoveRandomly( entity );
|
|
} else {
|
|
Vector3 dir = Vector3.Normalize( target.Position - entity.Position );
|
|
MoveInDirection( entity, dir );
|
|
}
|
|
}
|
|
|
|
public override void AttackedBy( Entity source ) {
|
|
}
|
|
}
|
|
}
|