Example #1
0
 private void RegisterSkillButtonEvent(CharacterRepository characterRepository, Button skillButton,
                                       GameObject skill1TimeBarGameObject, BattleObject battleObject, Action.Type actionType)
 {
     skillButton.onClick.AsObservable()
     .Where(_ => Mathf.Approximately(skill1TimeBarGameObject.GetComponent <Image>().fillAmount, 1.0f))
     .Subscribe(_ =>
     {
         characterRepository.Characters.Values.ToList().ForEach(character =>
         {
             character.SkillButtonsGameObject.transform.Find("Skill1/TimeBar")
             .GetComponent <Button>().interactable = false;
             character.SkillButtonsGameObject.transform.Find("Skill2/TimeBar")
             .GetComponent <Button>().interactable = false;
         });
         skillButton.interactable = true;
         skillButton.enabled      = false;
         _actionPipeline.PutForSkill(
             new Action
         {
             AttackType   = actionType,
             BattleObject = battleObject
         });
     })
     .AddTo(gameObject);
 }
Example #2
0
        private GameObject InstantiateForReactionEffect(BattleObject parent, string particleName)
        {
            if (particleName == null)
            {
                return(null);
            }
            var obj = (GameObject)Instantiate(Resources.Load <Object>(particleName),
                                              Vector2.zero, Quaternion.identity);
            var canvasGroup = obj.GetComponent <CanvasGroup>();

            canvasGroup.alpha = 0;
            obj.transform.SetParent(parent.GameObject.transform, false);
            return(obj);
        }