Esempio n. 1
0
 public HpChangedArgs(string who, Cint last, Cint actual, Action action)
 {
     Who    = who ?? throw new ArgumentNullException(nameof(who));
     Last   = last;
     Actual = actual;
     Action = action;
 }
Esempio n. 2
0
    protected virtual void Update()
    {
        if (buttons.Length == 0)
        {
            return;
        }

        if (movement.y > 0)
        {
            selectId--;
        }

        else if (movement.y < 0)
        {
            selectId++;
        }

        if (selectId >= buttons.Length)
        {
            selectId = (Cint)(uint)(buttons.Length - 1);
        }

        for (int x = 0; x < buttons.Length; x++)
        {
            buttons[x].Button.color = (selectId == x) ? selectColor : nonSelectColor;
        }

        if (inputActions.PauseControls.Click.triggered)
        {
            buttons[selectId].OnClick.Invoke();
        }
    }
Esempio n. 3
0
    public void Select(Cint index)
    {
        if (index == selected)
        {
            return;
        }
        selected = index;

        RefreshSelect();
    }
Esempio n. 4
0
 protected virtual void Start()
 {
     foreach (ButtonWithEvent item in buttons)
     {
         Button trueButton = item.ButtonText.GetComponentInChildren <Button>();
         if (trueButton == null)
         {
             continue;
         }
         trueButton.onClick.AddListener(() => item.OnClick.Invoke());
         EventTrigger trigger = item.ButtonText.gameObject.TryGetElseAdd <EventTrigger>();
         trigger.Add(EventTriggerType.PointerEnter, (b) => selectId = (uint)buttons.GetIndex(element => element.ButtonText == item.ButtonText));
     }
 }
Esempio n. 5
0
    protected virtual void Update()
    {
        if (buttons.Length == 0)
        {
            return;
        }

        switch (currentMenuType)
        {
        case MenuType.UpDown:
            CheckMovementY();
            break;

        case MenuType.LeftRight:
            CheckMovementX();
            break;
        }

        if (selectId >= buttons.Length)
        {
            selectId = (Cint)(uint)(buttons.Length - 1);
        }


        if (changeColor == true)
        {
            for (int x = 0; x < buttons.Length; x++)
            {
                buttons[x].ButtonText.color = (selectId == x) ? selectColor : nonSelectColor;
            }
        }


        if (inputAction.MainMenu.Click.triggered)
        {
            buttons[selectId].OnClick.Invoke();
        }
    }
Esempio n. 6
0
    public float GenerateOneLine(float fromX, float blocks, float y,
                                 DrawLineFlags drawLineFlags)
    {
        GameObject[] objs     = new GameObject[10];
        Cint         cooldown = 0;

        bool[] holes = new bool[(int)blocks + 1];

        if (drawLineFlags.HasFlag(DrawLineFlags.DontMakeHoles) == false && makeHole && blocks >= 3)
        {
            for (int x = 2; x < blocks - 2; x++)
            {
                if (cooldown == 0 && Chance(chanceForHole))
                {
                    holes[x] = true;
                    cooldown = minHoleBreak;
                }
                else
                {
                    cooldown--;
                }
            }
        }

        for (int x = 0; x < blocks; x++)
        {
            BlockMode mode    = BlockMode.Center;
            bool      dontPut = drawLineFlags.HasFlag(DrawLineFlags.DontPutActiveItems);
            bool      anyMode = false;
            if (drawLineFlags.HasFlag(DrawLineFlags.DontMakeEdge) == false)
            {
                anyMode = true;
                if (x == 0)
                {
                    mode    = BlockMode.Left;
                    dontPut = true;
                }

                else if (x == blocks - 1)
                {
                    mode    = BlockMode.Right;
                    dontPut = true;
                }
                else
                {
                    anyMode = false;
                }
            }
            if (anyMode == false)
            {
                if (holes[x + 1])
                {
                    mode = BlockMode.Right;
                }
                else if (x > 0 && holes[x - 1])
                {
                    mode = BlockMode.Left;
                }
            }

            if (holes[x] == false)
            {
                GameObject block;
                objs[x] = block = PutBlock(new Vector2(fromX + x, y), dontPut, mode);
                if (drawLineFlags.HasFlag(DrawLineFlags.Flip))
                {
                    block.GetComponent <SpriteRenderer>().flipY = true;
                }
            }
        }
        blocksPacks.Enqueue(objs);
        return(fromX + blockInOneShoot);
    }
Esempio n. 7
0
 protected void Start()
 {
     ResourceCount = resourceCount;
     ResourceList.Add(this);
     OnResourceChange(resourceCount);
 }
Esempio n. 8
0
    /*
     * private bool AnyEnemyisAlive()
     * {
     *      SpawnedEnemies = SpawnedEnemies.Where(e => e != null).ToList();
     *
     *      return SpawnedEnemies.Count > 0;
     * }
     */

    protected new void Awake()
    {
        base.Awake();
        EnemySpawners = enemySpawners;
        EnemyCount    = enemyCount;
    }