Exemplo n.º 1
0
        public Owliver()
        {
            BodyComponent = new BodyComponent(this)
            {
                InitMode = BodyComponentInitMode.Manual,
            };
            RootComponent = BodyComponent;

            Movement = new MovementComponent(this)
            {
                BodyComponent         = BodyComponent,
                ManualInputProcessing = true,
                MaxMovementSpeed      = 3.5f,
            };

            Animation = new SpriteAnimationComponent(this)
            {
                AnimationTypes = new List <SpriteAnimationType>
                {
                    SpriteAnimationType.Owliver_Idle_Stick_Left,
                    SpriteAnimationType.Owliver_Idle_Stick_Right,
                    SpriteAnimationType.Owliver_Walk_Stick_Left,
                    SpriteAnimationType.Owliver_Walk_Stick_Right,
                    SpriteAnimationType.Owliver_Attack_Stick_Left,
                    SpriteAnimationType.Owliver_Attack_Stick_Right,
                    SpriteAnimationType.Owliver_Idle_FishingRod_Left,
                    SpriteAnimationType.Owliver_Idle_FishingRod_Right,
                    SpriteAnimationType.Owliver_Walk_FishingRod_Left,
                    SpriteAnimationType.Owliver_Walk_FishingRod_Right,
                    SpriteAnimationType.Owliver_Attack_FishingRod_Left,
                    SpriteAnimationType.Owliver_Attack_FishingRod_Right,
                },
            };
            Animation.AttachTo(BodyComponent);

            Health = new HealthComponent(this)
            {
                MaxHealth = 5,
            };
            Health.OnHit += OnHit;

            GameObjectFactory.CreateOnHitSquasher(this, Health, Animation).SetDefaultCurves(HitDuration);

            GameObjectFactory.CreateOnHitBlinkingSequence(this, Health, Animation).SetDefaultCurves(HitDuration);

            MoneyBag = new MoneyBagComponent(this)
            {
                InitialAmount = 0,
            };

            KeyRing = new KeyRingComponent(this);
        }
Exemplo n.º 2
0
        public Tankton()
        {
            BodyComponent = new BodyComponent(this)
            {
                InitMode = BodyComponentInitMode.Manual,
            };
            RootComponent = BodyComponent;

            Animation = new SpriteAnimationComponent(this)
            {
                AnimationTypes = new List <SpriteAnimationType>
                {
                    SpriteAnimationType.Tankton_Idle_Left,
                    SpriteAnimationType.Tankton_Idle_Right,
                },
            };
            Animation.Spatial.Position.Y += Conversion.ToMeters(100);
            Animation.AttachTo(BodyComponent);

            Health = new HealthComponent(this)
            {
                MaxHealth = 20,
            };
            Health.OnHit   += OnHit;
            Health.OnDeath += OnDeath;

            HealthDisplay = new HealthDisplayComponent(this)
            {
                Health               = Health,
                HealthIcon           = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.Cross),
                InitialDisplayOrigin = HealthDisplayComponent.DisplayOrigin.Bottom,
                NumIconsPerRow       = 5,
            };
            HealthDisplay.AttachTo(Animation);

            GameObjectFactory.CreateOnHitSquasher(this, Health, Animation).SetDefaultCurves(
                duration: HitDuration,
                extremeScale: new Vector2(0.9f, 1.1f));

            GameObjectFactory.CreateOnHitBlinkingSequence(this, Health, Animation).SetDefaultCurves(HitDuration);
        }
Exemplo n.º 3
0
        public Slurp()
        {
            BodyComponent = new BodyComponent(this)
            {
                InitMode = BodyComponentInitMode.Manual,
            };
            RootComponent = BodyComponent;

            Animation = new SpriteAnimationComponent(this)
            {
                AnimationTypes = new List <SpriteAnimationType>
                {
                    SpriteAnimationType.Slurp_Idle_Left,
                    SpriteAnimationType.Slurp_Idle_Right,
                },
            };
            Animation.AttachTo(BodyComponent);

            Health = GameObjectFactory.CreateDefaultHealth(this,
                                                           maxHealth: 3,
                                                           hitDuration: HitDuration,
                                                           deathParticleTimeToLive: TimeSpan.FromSeconds(1));

            HealthDisplay = new HealthDisplayComponent(this)
            {
                Health = Health,
                InitialDisplayOrigin = HealthDisplayComponent.DisplayOrigin.Bottom,
                HealthIcon           = SpriteAnimationFactory.CreateAnimationInstance(SpriteAnimationType.Cross),
            };
            HealthDisplay.AttachTo(Animation);

            GameObjectFactory.CreateOnHitSquasher(this, Health, Animation).SetDefaultCurves(HitDuration);

            GameObjectFactory.CreateOnHitBlinkingSequence(this, Health, Animation).SetDefaultCurves(HitDuration);

            Homing = GameObjectFactory.CreateDefaultHomingCircle(this, BodyComponent,
                                                                 sensorRadius: 3.0f,
                                                                 homingType: HomingType.ConstantSpeed,
                                                                 homingSpeed: 0.5f);
        }