public override void OnDetached( AbstractEntity entity ) { powerup.OnUpdate -= OnUpdate; this.island.GetVector3Attribute(CommonNames.Position).ValueChanged -= OnIslandPositionChanged; if (entity.HasProperty("collision")) { entity.GetProperty <CollisionProperty>("collision").OnContact -= PowerupCollisionHandler; } }
public override void OnAttached(AbstractEntity player) { base.OnAttached(player); Debug.Assert(player.HasProperty("position_handler")); this.player = player as Entity; this.constants = Game.Instance.Simulation.EntityManager["player_constants"]; this.templates = Game.Instance.ContentManager.Load <LevelData>("Level/Common/DynamicTemplates"); this.playerIndex = (PlayerIndex)player.GetInt(CommonNames.GamePadIndex); this.controllerInput = player.GetProperty <InputProperty>("input").ControllerInput; this.player.GetStringAttribute("active_island").ValueChanged += OnActiveIslandChanged; this.player.GetStringAttribute("destination_island").ValueChanged += OnDestinationIslandChanged; }