コード例 #1
0
        public IEntity CreateFortress(Vector2 position, int owner, int goldValue)
        {
            IEntity entity = new Entity(scene, position, new Vector2(7f, 8f), true);

            new OwnerComponent(entity, owner);
            new SelectComponent(entity);

            new HealthComponent(entity, 1200, 4);
            new HealthDisplayComponent(entity);
            new AttackComponent(entity, 55, 2f, 3.5f, 1f, AttackComponent.AttackType.Far, new Dictionary <int, float>());
            new HealerComponent(entity, 2f, 0.1f, 3.5f);
            new WinComponent(entity, owner == 0, 2f);
            new CollisionComponent(entity);
            new BuyArmyComponent(entity);
            new CaptureGoldComponent(entity, goldValue);

            DrawTextureComponent texComp = new DrawTextureComponent(entity, (int)GameLayer.GameObject, "Fortress-" + owner);

            if (owner == 0)
            {
                texComp.Flipped = true;
            }

            new AIComponent(entity, Service.AI.AiType.Fortress);

            return(entity);
        }
コード例 #2
0
        private void Attack()
        {
            attackAnimation = true;
            damaged         = false;
            lastAnimation   = Parent.Scene.ServiceProvider.GetService <ITimeService>().AbsoluteTime;
            orginalTexture  = Parent.GetComponent <DrawTextureComponent>();
            Parent.RemoveComponent <DrawTextureComponent>();

            int owner = Parent.GetComponent <OwnerComponent>().Owner;

            string[] tex = new[] { orginalTexture.Texture };
            if (orginalTexture.Texture.StartsWith("Archer"))
            {
                tex = new string[16];
                for (var i = 0; i < tex.Length; i++)
                {
                    tex[i] = "Archer-Animation" + i + "-" + owner;
                }
            }
            else if (orginalTexture.Texture.StartsWith("Knight"))
            {
                tex = new string[18];
                for (var i = 0; i < tex.Length; i++)
                {
                    tex[i] = "Knight-Animation" + i + "-" + owner;
                }
            }

            new DrawAnimationComponent(Parent, orginalTexture.Layer, tex, 10f)
            {
                Repeat       = false,
                LoopFinished = CancelAnimation,
            };
            UpdateAnimation();
        }
コード例 #3
0
ファイル: TileSetControl.cs プロジェクト: RhythNS/TileEditor
        protected override void Initialize()
        {
            base.Initialize();

            Actor drawActor = Stage.CreateActor(0);

            drawActor.AddComponent <Transform2>();
            dtc = drawActor.AddComponent <DrawTextureComponent>();
        }