예제 #1
0
        //---------------------------------------------------------------------------

        public Spike(string name, Guid parent) : base(name, parent)
        {
            IsActive = false;

            AddComponent <TransformComponent>();
            AddComponent <PhysicsComponent>();

            RectColliderComponent collider = AddComponent <RectColliderComponent>();

            collider.Init(64, 64, BodyType.Static);
            collider.SetSensor(true);

            AnimationComponent animation = AddComponent <AnimationComponent>();

            animation.Init(AssetManager.Get().Find <Texture2D>(ESpriteAssets.Spikes1), new Vector2(3, 3));
            animation.AddSetting(0, new AnimationSetting(3, 1, false)
            {
                FPS = 10
            });
            animation.AddSetting(0, new AnimationSetting(3, 1, true)
            {
                FPS = 10
            });

            Activate();
        }
예제 #2
0
        public MeleeWeapon(string name, Guid parent) : base(name, parent)
        {
            PhysicsComponent physics = AddComponent <PhysicsComponent>();

            physics.Init(BodyType.Dynamic, 0, 0, true);
            physics.IsGravityAffected = false;
            physics.Body.Enabled      = false;

            RectColliderComponent collider = AddComponent <RectColliderComponent>();

            collider.Init(35, 35, new Vector2(40, -30));
            collider.SetSensor(true);
        }