예제 #1
0
 private void SetActionButton(Button button, ExploreCat cat, ActionType act)
 {
     button.onClick.AddListener(() =>
     {
         cat.useAction();
     });
     button.transform.Find("text").GetComponent <TextMeshProUGUI>().text = act.ToString();
     cat.Action = button;
 }
예제 #2
0
    public void startFight(ExploreCat enemy)
    {
        fadeSelector();
        ExploreCat cEnemy = getCurrentEnemy();
        ExploreCat user   = getCurrentUser();

        if (user == null || cEnemy == null)
        {
            return;
        }
        user.target = enemy;
        user.Enable();
        if (cEnemy.sideEffect != null)
        {
            cEnemy.checkRemoveEffect();
            if (cEnemy.sideEffect != null)
            {
                user.onHit = (AttackType a, ExploreCat c) =>
                {
                    controller.playSound(a);
                    cEnemy.Enable();
                    c.onHit = controller.OnHit;
                };
                return;
            }
        }
        if (!cEnemy.usedAction && EnemyAction(cEnemy))
        //&& UnityEngine.Random.value > 0.15f)
        {
            if (cEnemy.target == null)
            {
                cEnemy.findTarget();
            }
            user.onHit = (AttackType a, ExploreCat c) =>
            {
                controller.playSound(a);
                cEnemy.useAction();
                c.Disable();
                c.onHit = controller.OnHit;
            };
            return;
        }
        cEnemy.Enable();
    }