private async Task SetGraphic(SpriteObject spriteObject, bool isOpen)
        {
            if ((isOpen && spriteObject.SpriteRenderer.sprite == GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Open) ||
                (!isOpen && spriteObject.SpriteRenderer.sprite == GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Closed))
            {
                return;
            }

            if (isOpen)
            {
                for (int i = 0; i < GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Transition.Length; i++)
                {
                    spriteObject.SetGraphic(GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Transition[i]);
                    await Task.Delay(25);
                }
            }
            else
            {
                for (int i = GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Transition.Length - 1; i >= 0; i--)
                {
                    spriteObject.SetGraphic(GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Transition[i]);
                    await Task.Delay(25);
                }
            }
            spriteObject.SetGraphic(isOpen ? GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Open : GameManager.GraphicsDictionary.WireDoorSprites.WireDoor_Closed);
        }
        public async void TriggerAction(SpriteObject spriteObject, string actionID)
        {
            if (actionID != JUMPTILE_JUMP_ACTION)
            {
                return;
            }

            spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Compressed);
            await Task.Delay(50);

            spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Normal);
            await Task.Delay(25);

            spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Extended);
            await Task.Delay(50);

            spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Normal);
        }
        private void SetGraphic(SpriteObject spriteObject, bool isCollected)
        {
            if (isCollected)
            {
                spriteObject.SetGraphic(GameManager.GraphicsDictionary.SushiSprites.SushiSprite_Ghost);
                spriteObject.PlayAnimation(GameManager.GraphicsDictionary.SushiSprites.Sushi_BobAnimation);

                Color ghostColor = Color.white;
                ghostColor.a = 0f;
                spriteObject.SpriteRenderer.color = ghostColor;
            }
            else
            {
                spriteObject.SetGraphic(GameManager.GraphicsDictionary.SushiSprites.SushiSprite);
                spriteObject.PlayAnimation(GameManager.GraphicsDictionary.SushiSprites.Sushi_BobAnimation);
                spriteObject.SpriteRenderer.color = Color.white;
            }
        }
Example #4
0
        private void SetGraphic(SpriteObject spriteObject, WireButtonEntity.ButtonModes buttonMode, bool isPressed)
        {
            switch (buttonMode)
            {
            case WireButtonEntity.ButtonModes.PressOnly:
                spriteObject.SetGraphic(isPressed ? GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Press_On : GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Press_Off);
                break;

            case WireButtonEntity.ButtonModes.Toggle:
                spriteObject.SetGraphic(isPressed ? GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Toggle_On : GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Toggle_Off);
                break;

            case WireButtonEntity.ButtonModes.Hold:
                spriteObject.SetGraphic(isPressed ? GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Hold_On : GameManager.GraphicsDictionary.WireButtonSprites.ButtonSprite_Hold_Off);
                break;

            default:
                throw new System.Exception($"Unimplemented graphics for button mode [{buttonMode}]");
            }
        }
 public void UpdateToResult(SpriteObject spriteObject, UpdateResult updateResult) => spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Normal);
 public void UpdateToEntity(SpriteObject spriteObject, Entity entity) => spriteObject.SetGraphic(GameManager.GraphicsDictionary.JumpTileSprites.JumpTileSprite_Normal);
Example #7
0
        public override void InitializeEntity(SpriteObject spriteObject, Entity entity)
        {
            base.InitializeEntity(spriteObject, entity);

            spriteObject.SetGraphic(GameManager.GraphicsDictionary.SlidingCrateSprite);
        }