protected override void OnInitialize() { spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\Player\Player"); spriterComponent.Initialize(); spriterComponent.Scale = 0.2f; Owner.AddComponent(spriterComponent); Owner.InitializeComponents(); }
public SpriterEffect(GameObject owner, string name) : base(owner, false) { component = new SpriterComponent <Texture2D>(owner, name); component.Initialize(); owner.AddComponent(component); component.OnAnimationFinished += component_OnAnimationFinished; }
protected override void OnInitialize() { MonsterBuilder builder = new BlobBuilder(); builder.Build(Owner); Tree tree = CreateTree(); tree.Initialize(); Owner.AddComponent(tree); spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\Boss\Boss"); spriterComponent.Initialize(); spriterComponent.ChangeAnimation("Walk"); spriterComponent.Scale = 0.75f; Owner.AddComponent(spriterComponent); steeringComponent = Owner.FirstComponentOfType <SteeringComponent>(); SteeringBehavior seek = new SeekBehavior() { DesiredVelocity = new Vector2(1.25f), MaxSpeed = 1.25f }; steeringComponent.AddBehavior(seek); steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior)); rotation = Owner.FirstComponentOfType <SkillRotation>(); targetingComponent = Owner.FirstComponentOfType <TargetingComponent>(); BossHealthComponent c = new BossHealthComponent(Owner); c.Initialize(); Owner.AddComponent(c); rotation.Enable(); }
// TODO: duplicated code. Crawlerilla melkein sama init logic. protected override void OnInitialize() { MonsterBuilder builder = new ZombieBuilder(); builder.Build(Owner); Tree tree = CreateTree(); tree.Initialize(); Owner.AddComponent(tree); // Idle, Walk, Attack spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\GenericZombie\GenericZombie"); spriterComponent.Initialize(); spriterComponent.ChangeAnimation("Walk"); spriterComponent.Scale = 0.5f; Owner.AddComponent(spriterComponent); steeringComponent = Owner.FirstComponentOfType <SteeringComponent>(); SteeringBehavior flee = new FleeBehavior() { DesiredVelocity = new Vector2(4.25f), MaxSpeed = 3.25f }; SteeringBehavior seek = new SeekBehavior() { DesiredVelocity = new Vector2(4.25f), MaxSpeed = 3.25f }; steeringComponent.AddBehavior(flee); steeringComponent.AddBehavior(seek); steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior)); }
protected override void OnInitialize() { MonsterBuilder builder = new CrawlerBuilder(); builder.Build(Owner); Tree tree = CreateTree(); tree.Initialize(); Owner.AddComponent(tree); spriterComponent = new SpriterComponent <Texture2D>(Owner, @"Animations\Crawler\crawler"); spriterComponent.Initialize(); spriterComponent.ChangeAnimation("NewAnimation"); spriterComponent.Scale = 0.3f; Owner.AddComponent(spriterComponent); steeringComponent = Owner.FirstComponentOfType <SteeringComponent>(); SteeringBehavior flee = new FleeBehavior() { DesiredVelocity = new Vector2(2.25f), MaxSpeed = 1.25f }; SteeringBehavior seek = new SeekBehavior() { DesiredVelocity = new Vector2(2.25f), MaxSpeed = 1.25f }; steeringComponent.AddBehavior(flee); steeringComponent.AddBehavior(seek); steeringComponent.ChangeActiveBehavior(typeof(SeekBehavior)); }