public GameObject CreateOperator(GameObject operatorCreate, OperatorData operatorData, UISelectAvatar selectAvatar)
        {
            GameObject OperatorUI = Instantiate(MainController.OperatorInterfaseObject, operatorsParent.transform);

            OperatorUI.name = operatorData.Name;

            GameObject Operator = Instantiate(operatorCreate, OperatorUI.transform);

            Operator.transform.SetSiblingIndex(0);

            OperatorController operatorController = OperatorUI.GetComponent <OperatorController>();

            operatorController.selectAvatar    = selectAvatar;
            operatorController._operatorObject = Operator;
            operatorController._operatorData   = operatorData;


            operatorController.SetStartHP(operatorController._operatorData.maxHP);
            operatorController.SetStartSkillPoint(operatorController._operatorData.skill.initCost, operatorController._operatorData.skill.cost);

            CapsuleCollider capsuleCollider = OperatorUI.AddComponent <CapsuleCollider>();

            capsuleCollider.radius = 0.35f;

            Rigidbody rigidbody = OperatorUI.AddComponent <Rigidbody>();

            rigidbody.useGravity  = false;
            rigidbody.constraints = RigidbodyConstraints.FreezeAll;

            Operators.Add(OperatorUI);

            OperatorUI.transform.position = new Vector3(9999f, 9999f, 9999f);

            return(OperatorUI);
        }
Exemple #2
0
        IEnumerator ActiveSkillWithCount(OperatorController operatorController, StartSkill startSkill = null, EachSecondSkill eachSecondSkill = null, EndSkill endSkill = null, int _duration = 0, int eachSecondSkillParametr = 0)
        {
            isActive    = true;
            isCanActive = false;
            operatorController.SetStartSkillPoint(duration, duration);

            startSkill?.Invoke(operatorController);

            MainController.mainInterfaceFields.selectOperatorUI.updateSelectInfo(operatorController._operatorData);

            if (duration > 0)
            {
                curDurationTime = duration;
            }
            else
            {
                if (_duration > 0)
                {
                    curDurationTime = _duration;
                }
            }

            while (curDurationTime > 0)
            {
                if (MainController.mainInterfaceFields.selectOperatorUI.operatorController != null)
                {
                    eachSecondSkill?.Invoke(operatorController, eachSecondSkillParametr);
                    operatorController.SetSkillPoint(curDurationTime - 1);

                    MainController.mainInterfaceFields.selectOperatorUI.updateSelectInfoOnlySkill();
                }
                curDurationTime--;
                yield return(new WaitForSeconds(1f));
            }

            endSkill?.Invoke(operatorController);

            MainController.mainInterfaceFields.selectOperatorUI.updateSelectInfo(operatorController._operatorData);


            isActive    = false;
            isCanActive = true;
            operatorController.StartCoroutine(SkillPointGenerate(operatorController));

            yield return(null);
        }
Exemple #3
0
        public IEnumerator SkillPointGenerate(OperatorController operatorController, int startGenerate = 0)
        {
            curSkillPoint = startGenerate;
            isCanActive   = false;
            isActive      = false;
            operatorController.SetStartSkillPoint(0, cost);

            MainController.mainInterfaceFields.selectOperatorUI.updateSelectInfoOnlySkill();

            while (curSkillPoint < cost)
            {
                operatorController.SetSkillPoint(curSkillPoint + 1);

                MainController.mainInterfaceFields.selectOperatorUI.updateSelectInfoOnlySkill();
                curSkillPoint++;
                yield return(new WaitForSeconds(1f));
            }
            isCanActive = true;
            isActive    = false;
            yield return(null);
        }