public void InitPosition() { if (movementTypeOld == movementType) { return; } movementTypeOld = movementType; switch (movementType) { case NPC.MovementType.AREA: // polyNav.OnDestinationReached -= ResetStationary; polyNav.OnDestinationReached -= RemoveLastPatrolPointReached; polyNav.OnDestinationReached += GetNewAreaPoint; break; case NPC.MovementType.PATROL: // polyNav.OnDestinationReached -= GetNewAreaPoint; polyNav.OnDestinationReached -= ResetStationary; polyNav.OnDestinationReached += RemoveLastPatrolPointReached; break; case NPC.MovementType.STATIONARY: //set start direction ResetStationary(); polyNav.OnDestinationReached -= GetNewAreaPoint; polyNav.OnDestinationReached -= RemoveLastPatrolPointReached; polyNav.OnDestinationReached += ResetStationary; break; } }
public void SetMovementType(NPC.MovementType ms) { movementType = ms; InitPosition(); }