protected bool entityCollidesWithScenery() { Entity entity = party.PrimaryPartyMember.OverworldEntity; foreach (Scenery scenery in overworld.SceneryEntities) { if (entity.CollidesWith(scenery)) { return(true); } } return(false); }
protected bool entityCollidesWithOtherEnemy() { Entity entity = party.PrimaryPartyMember.OverworldEntity; foreach (Party enemyParty in overworld.EnemyParties) { Entity otherEntity = enemyParty.PrimaryPartyMember.OverworldEntity; if (entity != otherEntity && entity.CollidesWith(otherEntity)) { return(true); } } return(false); }
private void _moveTo(object[] args) { // moveTo(string actorPartyMemberSelector, string targetPartyMemberSelector, float speed, bool accelerate, Script callback) string actorPartyMemberSelector = (string)args[0]; string targetPartyMemberSelector = (string)args[1]; float speed = (float)args[2]; bool accelerate = (bool)args[3]; Script callback = (Script)args[4]; PartyMember actor = getPartyMemberFromSelector(actorPartyMemberSelector); PartyMember target = getPartyMemberFromSelector(targetPartyMemberSelector); Entity actorEntity = actor.BattleEntity; Entity targetEntity = target.BattleEntity; Vector2 velocityVector = targetEntity.Position - actorEntity.Position; velocityVector.Normalize(); velocityVector *= speed; if (accelerate) { actorEntity.Acceleration = velocityVector; } else { actorEntity.Velocity = velocityVector; } this.blocked = true; ScriptRunner self = this; actorEntity.UpdateExtensions.Add(new UpdateExtension((updateExtension, delta) => { if (actorEntity.CollidesWith(targetEntity)) { updateExtension.Active = false; self.blocked = false; TriggerTrap(actor, target); if (actor.Alive) { addNestedScriptRunner(callback, 0.0f); } } })); }