当前位置: 首页>>代码示例>>C#>>正文


C# FSprite.GetPosition方法代码示例

本文整理汇总了C#中FSprite.GetPosition方法的典型用法代码示例。如果您正苦于以下问题:C# FSprite.GetPosition方法的具体用法?C# FSprite.GetPosition怎么用?C# FSprite.GetPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在FSprite的用法示例。


在下文中一共展示了FSprite.GetPosition方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: UI

 public UI()
 {
     dialogue = new Dialogue();
     this.AddChild(dialogue);
     background = new FSprite("bg");
     slotA = new FSprite("slot_a");
     slotB = new FSprite("slot_b");
     slotASelected = new FSprite("jump_soul");
     slotBSelected = new FSprite("sword_soul");
     hearts = new FSprite("heart_full");
     this.AddChild(background);
     this.AddChild(slotA);
     this.AddChild(slotB);
     this.AddChild(slotASelected);
     this.AddChild(slotBSelected);
     this.AddChild(hearts);
     slotASelected.isVisible = false;
     slotBSelected.isVisible = false;
     background.y = Futile.screen.halfHeight - background.height / 2f;
     slotB.y = background.y;
     slotA.y = background.y;
     slotB.x = -Futile.screen.halfWidth + slotB.width / 2f + 20;
     slotA.x = slotB.x + slotB.width / 2f + slotA.width / 2f + 3;
     slotASelected.SetPosition(slotA.GetPosition());
     slotBSelected.SetPosition(slotB.GetPosition());
     slotASelected.x += 1;
     slotBSelected.x += 1;
     hearts.y = background.y;
     hearts.x = Futile.screen.halfWidth - hearts.width / 2f - 20;
 }
开发者ID:maggardJosh,项目名称:SpiritGuard,代码行数:30,代码来源:UI.cs

示例2: UI

    public UI(World w)
    {
        this.w = w;
        for (int i = 0; i < MAX_HEALTH; i++)
        {
            hearts[i] = new FSprite("heart");
            hearts[i].x = Futile.screen.halfWidth - hearts[i].width / 2f - uiSideMargin - (i * (hearts[i].width + heartSpace));
            hearts[i].y = Futile.screen.halfHeight - hearts[i].height / 2f - uiSideMargin;
            this.AddChild(hearts[i]);

        }
        selectedPowerupBG = new FSprite("powerupSelect");
        selectedPowerupBG.x = -Futile.screen.halfWidth + selectedPowerupBG.width / 2f + uiSideMargin + 20;
        selectedPowerupBG.y = hearts[0].y;
        this.AddChild(selectedPowerupBG);

        selectedPowerup = new FSprite("normalpowerup");
        selectedPowerup.SetPosition(selectedPowerupBG.GetPosition());
        this.AddChild(selectedPowerup);

        killCount = new FLabel(C.smallFontName, "0");
        killCount.y = Futile.screen.halfHeight - killCount.textRect.height / 2f - uiSideMargin;
        this.AddChild(killCount);
    }
开发者ID:maggardJosh,项目名称:OGREAT,代码行数:24,代码来源:UI.cs

示例3: HandlePlayerCollision

 public void HandlePlayerCollision(Player p)
 {
     if (p.isColliding(this))
     {
         //FSoundManager.PlaySound("powerup");
         isBeingPickedUp = true;
         FSoundManager.TweenVolume(.3f);
         p.isVisible = false;
         Go.killAllTweensWithTarget(p);
         p.State = Player.PlayerState.IDLE;
         p.xVel = 0;
         p.yVel = 0;
         Go.killAllTweensWithTarget(this);
         FSprite playerPickup = new FSprite("player_13");
         C.getCameraInstance().AddChild(playerPickup);
         Vector2 playerRelativePosition = p.GetPosition() + Futile.stage.GetPosition() - Vector2.up * 16f;
         playerPickup.SetPosition(playerRelativePosition);
         this.SetPosition(this.GetPosition() + Futile.stage.GetPosition() - Vector2.up * 16f);
         world.removeObject(this);
         C.getCameraInstance().AddChild(this);
         world.forceWaitLoad = true;
         RXDebug.Log(this.GetPosition(), playerPickup.GetPosition());
         this.MoveToFront();
         FLabel label = new FLabel(C.largeFontName, type.ToString().ToUpper() + " SPIRIT");
         C.getCameraInstance().AddChild(label);
         label.y = Futile.screen.halfHeight - label.textRect.height / 2f - 10;
         label.x = Futile.screen.halfWidth + label.textRect.width / 2f + 10;
         world.ShowLoading(() =>
         {
             Go.to(playerPickup, 2.0f, new TweenConfig().floatProp("x", 0).floatProp("y", -15).setEaseType(EaseType.QuadOut));
             Go.to(this, 2.0f, new TweenConfig().floatProp("x", 0).floatProp("y", 15).setEaseType(EaseType.QuadOut));
             Go.to(label, 1.5f, new TweenConfig().floatProp("x", 0).setEaseType(EaseType.BackOut).setDelay(1.5f).onComplete(() =>
             {
                 Go.to(this, .01f, new TweenConfig().floatProp("x", 1, true).onComplete(() =>
                 {
                     Go.to(this, .01f, new TweenConfig().floatProp("x", -2, true).setIterations(100, LoopType.PingPong).onComplete(() =>
                     {
                         FSoundManager.PlaySound("orbExplosion");
                         FSoundManager.PlaySound("powerup");
                         SpawnParticles(30);
                         this.x -= 1;
                         sprite.SetElementByName(type.ToString().ToLower() + "_soul");
                         Go.to(label, 1.5f, new TweenConfig().floatProp("x", -Futile.screen.halfWidth - label.textRect.width / 2f - 10).setEaseType(EaseType.BackIn).setDelay(2.0f).onStart((AbstractTween t) => { }).onComplete(() =>
                         {
                             label.RemoveFromContainer();
                             Go.to(playerPickup, 1.0f, new TweenConfig().floatProp("x", playerRelativePosition.x).floatProp("y", playerRelativePosition.y).setEaseType(EaseType.QuadInOut).onComplete(() =>
                             {
                                 FSoundManager.TweenVolume(1.0f);
                                 p.PickupSoul(this);
                                 world.HideLoading(() => { p.isVisible = true; playerPickup.RemoveFromContainer(); this.RemoveFromContainer(); });
                             }));
                             Vector2 powerupPos;
                             switch(type)
                             {
                                 case SoulType.JUMP:
                                     powerupPos = world.ui.slotAPos;
                                     break;
                                 default:
                                     powerupPos = world.ui.slotBPos;
                                     break;
                             }
                             Go.to(this, 1.0f, new TweenConfig().floatProp("x", powerupPos.x).floatProp("y", powerupPos.y).setEaseType(EaseType.QuadInOut));
                         }));
                     }));
                 }));
             }));
         });
     }
 }
开发者ID:maggardJosh,项目名称:SpiritGuard,代码行数:69,代码来源:SoulPickup.cs


注:本文中的FSprite.GetPosition方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。