public override void Start() { // if no pathing blocks, just randomly pick something. if (this.position == Vector3.zero) { int maxDistance = 30; if (this.theEntity.IsAlert) { this.position = RandomPositionGenerator.CalcAway(this.theEntity, 0, maxDistance, maxDistance, this.theEntity.LastTargetPos); } else { this.position = RandomPositionGenerator.Calc(this.theEntity, maxDistance, maxDistance); } } this.time = 0f; EntityUtilities.ChangeHandholdItem(this.theEntity.entityId, EntityUtilities.Need.Reset); // Turn off the entity jumping, and turn on breaking blocks, to allow for better pathing. if (this.theEntity is EntityAliveSDX) { (theEntity as EntityAliveSDX).canJump = false; (theEntity as EntityAliveSDX).moveHelper.CanBreakBlocks = true; } // Path finding has to be set for Breaking Blocks so it can path through doors PathFinderThread.Instance.FindPath(this.theEntity, this.position, this.theEntity.GetMoveSpeed(), true, this); return; }
public static void BackupHelper(int EntityID, Vector3 awayFrom, int distance) { EntityAlive myEntity = GameManager.Instance.World.GetEntity(EntityID) as EntityAlive; if (myEntity == null) { return; } if (myEntity.moveHelper == null) { return; } Vector3 dirV = myEntity.position - awayFrom; Vector3 vector = Vector3.zero; // If you are blocked, try to go to another side. vector = RandomPositionGenerator.CalcAway(myEntity, distance, distance, distance, awayFrom); myEntity.moveHelper.SetMoveTo(vector, false); // Move away at a hard coded speed of -4 to make them go backwards myEntity.speedForward = -4f;// Mathf.SmoothStep(myEntity.speedForward, -0.25f, 2 * Time.deltaTime); // Keep them facing the spot // myEntity.SetLookPosition( awayFrom ); //myEntity.RotateTo(awayFrom.x, awayFrom.y, awayFrom.z, 30f, 30f); }
public override void Start() { // if no pathing blocks, just randomly pick something. Vector3 newPosition = EntityUtilities.GetNewPositon(this.theEntity.entityId); if (newPosition == Vector3.zero) { this.position = RandomPositionGenerator.CalcAway(this.theEntity, 10, 30, 10, this.theEntity.position); } //Give them more time to path find.The CanContinue() stops at 30f, so we'll set it at -90, rather than 0. this.time = -90f; // Path finding has to be set for Breaking Blocks so it can path through doors PathFinderThread.Instance.FindPath(this.theEntity, this.position, this.theEntity.GetMoveSpeed(), true, this); return; }
public override void Start() { // if no pathing blocks, just randomly pick something. if (this.position == Vector3.zero) { Vector3 vector = Vector3.zero; int num2 = 30; if (this.theEntity.IsAlert) { vector = RandomPositionGenerator.CalcAway(this.theEntity, 0, num2, num2, this.theEntity.LastTargetPos); } else { vector = RandomPositionGenerator.Calc(this.theEntity, num2, num2); } this.position = vector; this.time = 0f; } else { this.time = -60f; } //Vector3 temp = Ent //EntityUtilities.GetNewPositon(this.theEntity.entityId); //if (temp != Vector3.zero) //{ // this.position = temp; // //Give them more time to path find.The CanContinue() stops at 30f, so we'll set it at -90, rather than 0. // this.time = 90f; //} // EntityUtilities.ChangeHandholdItem(this.theEntity.entityId, EntityUtilities.Need.Melee); // Path finding has to be set for Breaking Blocks so it can path through doors PathFinderThread.Instance.FindPath(this.theEntity, this.position, this.theEntity.GetMoveSpeed(), true, this); return; }