Exemple #1
0
        public Midori(Vector3 position) : base(_name, _portraitPath, position, new Vector2(360, 360))
        {
            Name     = _name;
            IsPlayer = true;

            Position     = position;
            Size         = new Vector2(360, 360);       // 264, 264
            TextureAsset = Engine.AssetLoader.Get <TextureAsset>($"Textures/{_portraitPath}");
            PortraitSize = new Vector2(750, 1033.467f); // Size(250, 344.489f) * 3
            // Full Portrait Size is 1773x2213

            TextureAsset spriteAsset = Engine.AssetLoader.Get <TextureAsset>(_spriteSheetPath);

            Sprite = new AnimatedTexture(
                spriteAsset,
                new Vector2(24, 24),
                AnimationLoopType.Normal,
                1500,
                0,
                1
                );

            InteractRange     = 360;
            InteractionOffset = new Vector2(0, 70);

            StartingVelocityY = _verticalVelocity;
            VelocityX         = _horizontalVelocity;

            // Set CollisionBox offsets
            // Reminder: Don't forget to update the SetCollisionBox methods!
            CollisionBox = new Transform(
                X + 140,
                Y + 40,
                Z + 15,
                80,
                320
                );


            RunTimer = new AfterAndBack(150); // Progress 0

            JumpTimer    = new AfterAndBack(400);
            GravityTimer = new AfterAndBack(100);
            GravityTimer.End(); // Set Progress to 1

            // Gravity Push
            IsGravityPushActive          = false;
            GravityPushRange             = _gravityPushDefaultRange;
            GravityPushPower             = _gravityPushDefaultPower;
            ObjectsAffectedByGravityPush = new List <Unit>();
            GravityPushNoTargetsFound    = false;
        }
        public Unit(string name, string textureName, Vector3 position, Vector2 size)
        {
            Name        = name;
            TextureName = textureName;
            Position    = position;
            Size        = size;

            TextureAsset = Engine.AssetLoader.Get <TextureAsset>($"Textures/{TextureName}");

            IsPlayer   = false;
            IsIdle     = true;
            IsGrounded = true;

            RunTimer = new AfterAndBack(200); // Progress 0

            JumpTimer    = new AfterAndBack(600);
            GravityTimer = new AfterAndBack(300);
            GravityTimer.End(); // Set Progress to 1

            StartingVelocityY = _defaultVerticalVelocity;
            VelocityX         = _defaultHorizontalVelocity;

            InclineAngle = 0;
        }