Exemplo n.º 1
0
    private void Awake()
    {
        instance = this;
        GameObject gameObject = new GameObject("topBar", typeof(Image));

        gameObject.transform.SetParent(transform, false);
        gameObject.GetComponent <Image>().color = Color.black;
        topBar           = gameObject.GetComponent <RectTransform>();
        topBar.anchorMin = new Vector2(0, 1);
        topBar.anchorMax = new Vector2(1, 1);
        topBar.sizeDelta = new Vector2(0, 0);

        gameObject = new GameObject("bottomBar", typeof(Image));
        gameObject.transform.SetParent(transform, false);
        gameObject.GetComponent <Image>().color = Color.black;
        bottomBar           = gameObject.GetComponent <RectTransform>();
        bottomBar.anchorMin = new Vector2(0, 0);
        bottomBar.anchorMax = new Vector2(1, 0);
        bottomBar.sizeDelta = new Vector2(0, 0);

        CMDebug.ButtonUI(new Vector2(-200, 0), "Show", () => {
            Show(300, .3f);
        });
        CMDebug.ButtonUI(new Vector2(200, 0), "Hide", () => {
            Hide(.3f);
        });
    }
Exemplo n.º 2
0
    private void Start()
    {
        healthSystem = new HealthSystem(100);
        damagedBarImage.fillAmount = barImage.fillAmount;
        healthSystem.OnDamaged    += HealthSystem_OnDamaged;
        healthSystem.OnHealed     += HealthSystem_OnHealed;
        SetHealth(healthSystem.GetHealthNormalized());


        CMDebug.ButtonUI(new Vector2(-100, -50), "Damage", () => healthSystem.Damage(10));
        CMDebug.ButtonUI(new Vector2(+100, -50), "Heal", () => healthSystem.Heal(10));
    }
Exemplo n.º 3
0
    private void Start()
    {
        Minimap.Minimap.Init();

        CMDebug.ButtonUI(new Vector2(300, 200), "Show Minimap", Minimap.Minimap.ShowWindow);
        CMDebug.ButtonUI(new Vector2(300, 160), "Hide Minimap", Minimap.Minimap.HideWindow);

        CMDebug.ButtonUI(new Vector2(300, 120), "Player Icon Show", playerMinimapIcon.Show);
        CMDebug.ButtonUI(new Vector2(300, 80), "Player Icon Hide", playerMinimapIcon.Hide);

        CMDebug.ButtonUI(new Vector2(300, 20), "Zoom In", Minimap.Minimap.ZoomIn);
        CMDebug.ButtonUI(new Vector2(300, -20), "Zoom Out", Minimap.Minimap.ZoomOut);
    }
Exemplo n.º 4
0
    private void Awake()
    {
        barMaskRectTransform = transform.Find("barMask").GetComponent <RectTransform>();
        barRawImage          = transform.Find("barMask").Find("bar").GetComponent <RawImage>();
        edgeRectTransform    = transform.Find("edge").GetComponent <RectTransform>();

        barMaskWidth = barMaskRectTransform.sizeDelta.x;

        mana = new Mana();

        CMDebug.ButtonUI(new Vector2(0, -100), "Spend Mana", () => {
            mana.TrySpendMana(30);
        });
    }
    private void Start()
    {
        FunctionPeriodic.Create(HealingAnimatedPeriodic, .05f);
        HeartsHealthSystem heartsHealthSystem = new HeartsHealthSystem(5);

        SetHeartsHealthSystem(heartsHealthSystem);


        //Testing buttons
        CMDebug.ButtonUI(new Vector2(-50, -100), "Damage 1", () => heartsHealthSystem.Damage(1));
        CMDebug.ButtonUI(new Vector2(50, -100), "Damage 4", () => heartsHealthSystem.Damage(4));

        CMDebug.ButtonUI(new Vector2(-50, -200), "Heal 1", () => heartsHealthSystem.Heal(1));
        CMDebug.ButtonUI(new Vector2(50, -200), "Heal 4", () => heartsHealthSystem.Heal(4));
        CMDebug.ButtonUI(new Vector2(150, -200), "Heal 50", () => heartsHealthSystem.Heal(50));
    }
    private void Awake()
    {
        guestSpritesheetData = GuestSpritesheetData.GenerateRandom();
        SetGuestSpritesheetData(guestSpritesheetData);

        CMDebug.ButtonUI(new Vector2(100, -170), "Randomize", () => {
            guestSpritesheetData = GuestSpritesheetData.GenerateRandom();
            SetGuestSpritesheetData(guestSpritesheetData);
        });
        CMDebug.ButtonUI(new Vector2(250, -170), "Save", () => {
            guestSpritesheetData.Save();
            CMDebug.TextPopupMouse("Saved!");
        });
        CMDebug.ButtonUI(new Vector2(400, -170), "Load", () => {
            guestSpritesheetData = GuestSpritesheetData.Load_Static();
            SetGuestSpritesheetData(guestSpritesheetData);
            CMDebug.TextPopupMouse("Loaded!");
        });
    }
Exemplo n.º 7
0
    // Start is called before the first frame update
    private void Start()
    {
        HealthSystem healthSystem = new HealthSystem(100);

        Transform healthBarTransform = Instantiate(HealthBarPrefab, new Vector3(transform.position.x, (transform.position.y + 1f)), Quaternion.identity);

        HealthBar healthBar = healthBarTransform.GetComponent <HealthBar>();

        healthBar.Setup(healthSystem);

        CMDebug.ButtonUI(new Vector2(100, 100), "damage", () => {
            healthSystem.Damage(10);
            Debug.Log("Damaged: " + healthSystem.GetHealth());
        });

        CMDebug.ButtonUI(new Vector2(-100, 100), "heal", () => {
            healthSystem.Heal(10);
            Debug.Log("Healed: " + healthSystem.GetHealth());
        });
    }
Exemplo n.º 8
0
    private void Start()
    {
        cameraFollow.Setup(() => playerTransform.position);

        CMDebug.ButtonUI(new Vector2(570, 330), "Player", () =>
        {
            cameraFollow.SetGetCameraFollowPositionFunc(() => playerTransform.position);
        });
        //CMDebug.ButtonUI(new Vector2(570, 330), "Character1", () =>
        //{
        //    cameraFollow.SetGetCameraFollowPositionFunc(() => character1Transform.position);
        //}); CMDebug.ButtonUI(new Vector2(570, 330), "Character2", () =>
        //{
        //    cameraFollow.SetGetCameraFollowPositionFunc(() => character2Transform.position);
        //});
        CMDebug.ButtonUI(new Vector2(570, 270), "Manual", () =>
        {
            cameraFollow.SetGetCameraFollowPositionFunc(() => manualMovementTransform.position);
        });
    }
Exemplo n.º 9
0
    private void Start()
    {
        Stats stats = new Stats(10, 2, 5, 10, 3);

        uiStatsRadarChart.SetStats(stats);

        CMDebug.ButtonUI(new Vector2(100, 20), "ATK++", () => stats.IncreaseStatAmount(Stats.Type.Attack));
        CMDebug.ButtonUI(new Vector2(100, -20), "ATK--", () => stats.DecreaseStatAmount(Stats.Type.Attack));

        CMDebug.ButtonUI(new Vector2(200, 20), "DEF++", () => stats.IncreaseStatAmount(Stats.Type.Defence));
        CMDebug.ButtonUI(new Vector2(200, -20), "DEF--", () => stats.DecreaseStatAmount(Stats.Type.Defence));

        CMDebug.ButtonUI(new Vector2(300, 20), "SPD++", () => stats.IncreaseStatAmount(Stats.Type.Speed));
        CMDebug.ButtonUI(new Vector2(300, -20), "SPD--", () => stats.DecreaseStatAmount(Stats.Type.Speed));

        CMDebug.ButtonUI(new Vector2(400, 20), "MAN++", () => stats.IncreaseStatAmount(Stats.Type.Mana));
        CMDebug.ButtonUI(new Vector2(400, -20), "MAN--", () => stats.DecreaseStatAmount(Stats.Type.Mana));

        CMDebug.ButtonUI(new Vector2(500, 20), "HEL++", () => stats.IncreaseStatAmount(Stats.Type.Health));
        CMDebug.ButtonUI(new Vector2(500, -20), "HEL--", () => stats.DecreaseStatAmount(Stats.Type.Health));
    }