Exemplo n.º 1
0
 public static SkillVar FsmVarPopup(GUIContent label, Skill fsm, SkillVar fsmVar, VariableType variableType = -1, Type objectConstraint = null)
 {
     EditorGUILayout.BeginHorizontal(new GUILayoutOption[0]);
     fsmVar = VariableEditor.DoFsmVarPopup(label, fsm, fsmVar, variableType, objectConstraint);
     VariableEditor.EndVariableEditor(fsmVar.get_NamedVar());
     return(fsmVar);
 }
Exemplo n.º 2
0
        private void HandleActionOne(PlayerController player)
        {
            SkillVar skill_kick      = player.GetSkill_BasicKick();
            SkillVar skill_ActionOne = player.GetSkill_BasicActionOne();
            SkillVar skill_selected  = null;

            //Select usage skill
            if (team.IsMyBall())
            {
                skill_selected = skill_kick;
            }
            else
            {
                skill_selected = skill_ActionOne;
            }

            UIAttack.SetIcon(skill_selected.ability.icon_withBall);
            UIAttack.SetValue(skill_selected.FillAmounValue);
            UIAttack.SetCooldown(skill_selected.FillAmountCooldown);

            if (skill_selected.IsCritical)
            {
                UIAttack.SetValueColor(Color.red);
            }
            else
            {
                UIAttack.ResetValueColor();
            }
        }
Exemplo n.º 3
0
        private void HandleActionTwo(PlayerController player)
        {
            SkillVar skill_pass      = player.GetSkill_BasicPass();
            SkillVar skill_ActionTwo = player.GetSkill_BasicActionTwo();
            SkillVar skill_selected  = null;

            //Select usage skill
            if (team.IsMyBall())
            {
                skill_selected = skill_pass;
            }
            else
            {
                skill_selected = skill_ActionTwo;
            }

            UIDeffense.SetIcon(skill_selected.ability.icon_withBall);
            UIDeffense.SetValue(skill_selected.FillAmounValue);
            UIDeffense.SetCooldown(skill_selected.FillAmountCooldown);

            if (skill_selected.IsCritical)
            {
                UIDeffense.SetValueColor(Color.red);
            }
            else
            {
                UIDeffense.ResetValueColor();
            }
        }
Exemplo n.º 4
0
    private SkillVar GetSkillsActioOne()
    {
        SkillVar pass          = player.GetSkill_BasicKick();
        SkillVar actionOne     = player.GetSkill_BasicActionOne();
        SkillVar selectedSkill = player.IsMyBall() ? pass : actionOne;

        return(selectedSkill);
    }
Exemplo n.º 5
0
    private SkillVar GetSkillsActionTwo()
    {
        SkillVar pass          = player.GetSkill_BasicPass();
        SkillVar actionTwo     = player.GetSkill_BasicActionTwo();
        SkillVar selectedSkill = player.IsMyBall() ? pass : actionTwo;

        return(selectedSkill);
    }
Exemplo n.º 6
0
    private void Handle_FollowBallState()
    {
        //Indo atraz da bola se estiver perto
        bool isBallNear  = Player.IsBallMostNear();
        bool teamHasBall = Player.IsBallfromMyTeam();

        if (isBallNear == false || teamHasBall == true || Player.IsMyBall() || Player.IsSelected())
        {
            Stop();
            aiState = SoccerAIState.nothing;
            return;
        }

        Vector3 ballPosition = BallController.GetPosition();

        ballPosition.y = Player.transform.position.y;

        //Rasteira ou acao secundaria
        PlayerController enemyforward;
        SkillVar         skill = Player.GetSkill_BasicActionTwo();

        if (Player.IsHitForwad(0.5f, out enemyforward, Player.GetCampTeam().Enemy()))
        {
            if (skill.IsReady)
            {
                motionType = LocomotionType.normal;
                if (Locomotion.TriggerPass())
                {
                    skill.TriggerCooldown();
                }
            }
        }

        Vector2 move = Locomotion.GetDirectionAI();

        Direction = move.x;
        Speed     = move.y;
        Agent.SetDestination(ballPosition);
    }
Exemplo n.º 7
0
        public static string GetMethodSignature(string methodName, SkillVar[] parameters, SkillVar result)
        {
            if (parameters == null || result == null)
            {
                return("");
            }
            Type   t    = result.get_RealType() ?? typeof(void);
            string text = TypeHelpers.GetFriendlyName(t) + " " + methodName + " (";
            bool   flag = true;

            for (int i = 0; i < parameters.Length; i++)
            {
                SkillVar fsmVar = parameters[i];
                if (!flag)
                {
                    text += ", ";
                }
                text += TypeHelpers.GetFriendlyName(fsmVar.get_RealType());
                flag  = false;
            }
            return(text + ")");
        }
Exemplo n.º 8
0
 private void FindVariableUsage(object obj, int currentDepth = 0)
 {
     if (obj != null && currentDepth < 7)
     {
         NamedVariable namedVariable = obj as NamedVariable;
         if (namedVariable != null && namedVariable.get_UsesVariable())
         {
             this.AddVariableUsage(namedVariable);
             return;
         }
         SkillVar fsmVar = obj as SkillVar;
         if (fsmVar != null && !string.IsNullOrEmpty(fsmVar.variableName))
         {
             this.AddVariableUsage(fsmVar.get_NamedVar());
             return;
         }
         if (obj.GetType().get_IsArray())
         {
             Array array = (Array)obj;
             for (int i = 0; i < array.get_Length(); i++)
             {
                 this.FindVariableUsage(array.GetValue(i), currentDepth);
             }
             return;
         }
         IEnumerable <FieldInfo> serializedFields = TypeHelpers.GetSerializedFields(obj.GetType());
         using (IEnumerator <FieldInfo> enumerator = serializedFields.GetEnumerator())
         {
             while (enumerator.MoveNext())
             {
                 FieldInfo current = enumerator.get_Current();
                 SkillSearch.currentInfo.fieldInObject = obj;
                 SkillSearch.currentInfo.field         = current;
                 object value = current.GetValue(obj);
                 this.FindVariableUsage(value, currentDepth + 1);
             }
         }
     }
 }
Exemplo n.º 9
0
        private void HandleStamina(PlayerController player)
        {
            SkillVar stamina = player.GetSkill_Stamina();

            //Modifica as sprites para mostrar as imagens corretas de ações com Bola e ações sem bola
            if (team.IsMyBall())//Sprites Ações com bola
            {
                UIStamina.SetIcon(stamina.ability.icon_withBall);
            }
            else //Sprites Ações sem bola
            {
                UIStamina.SetIcon(stamina.ability.icon_withOutBall);
            }

            UIStamina.SetValue(stamina.FillAmounValue);
            if (stamina.IsCritical)
            {
                UIStamina.SetValueColor(Color.red);
            }
            else
            {
                UIStamina.ResetValueColor();
            }
        }
Exemplo n.º 10
0
 private static SkillVar DoFsmVarPopup(GUIContent label, Skill fsm, SkillVar fsmVar, VariableType typeConstraint, Type objectConstraint)
 {
     ActionEditor.DoVariableSelector(label, fsm, fsmVar.get_Type(), fsmVar.get_NamedVar(), typeConstraint, objectConstraint);
     fsmVar.useVariable = true;
     return(fsmVar);
 }
Exemplo n.º 11
0
 private static void CheckParameterType(Type type, object fieldValue)
 {
     if (type == null)
     {
         return;
     }
     if (type == typeof(SkillGameObject))
     {
         FsmErrorChecker.CheckFsmGameObjectParameter((SkillGameObject)fieldValue);
     }
     else
     {
         if (type == typeof(SkillOwnerDefault))
         {
             FsmErrorChecker.CheckOwnerDefaultParameter((SkillOwnerDefault)fieldValue);
         }
         else
         {
             if (type == typeof(GameObject))
             {
                 FsmErrorChecker.CheckGameObjectParameter((GameObject)fieldValue);
             }
             else
             {
                 if (type == typeof(SkillEvent))
                 {
                     FsmErrorChecker.CheckFsmEventParameter((SkillEvent)fieldValue);
                 }
                 else
                 {
                     if (type == typeof(SkillString))
                     {
                         FsmErrorChecker.CheckFsmStringParameter((SkillString)fieldValue);
                     }
                     else
                     {
                         if (type == typeof(string))
                         {
                             FsmErrorChecker.CheckStringParameter((string)fieldValue);
                         }
                         else
                         {
                             if (type.get_IsArray())
                             {
                                 Array array = (Array)fieldValue;
                                 if (array != null)
                                 {
                                     Type elementType = type.GetElementType();
                                     for (int i = 0; i < array.get_Length(); i++)
                                     {
                                         FsmErrorChecker.CheckParameterType(elementType, array.GetValue(i));
                                     }
                                 }
                             }
                             else
                             {
                                 Object @object = fieldValue as Object;
                                 if (@object != null)
                                 {
                                     FsmErrorChecker.CheckObjectParameter(@object);
                                 }
                             }
                         }
                     }
                 }
             }
         }
     }
     if (type.IsSubclassOf(typeof(NamedVariable)))
     {
         if (FsmEditorSettings.CheckForRequiredField && FsmErrorChecker.IsRequiredField())
         {
             if (fieldValue == null)
             {
                 FsmErrorChecker.AddRequiredFieldError();
                 return;
             }
             NamedVariable namedVariable = (NamedVariable)fieldValue;
             if ((namedVariable.get_UseVariable() || FsmErrorChecker.IsVariableField()) && string.IsNullOrEmpty(namedVariable.get_Name()))
             {
                 FsmErrorChecker.AddRequiredFieldError();
                 return;
             }
         }
     }
     else
     {
         if (type == typeof(SkillVar) && FsmEditorSettings.CheckForRequiredField && FsmErrorChecker.IsRequiredField())
         {
             SkillVar fsmVar = (SkillVar)fieldValue;
             if (fsmVar.useVariable && (fsmVar.get_NamedVar() == null || fsmVar.get_NamedVar().get_IsNone()))
             {
                 FsmErrorChecker.AddRequiredFieldError();
             }
         }
     }
 }
Exemplo n.º 12
0
    void Update()
    {
        if (player == null)
        {
            return;
        }

        //Seleciona outro jogador manual mais proximo se eu estiver muito longe da bola
        if (player.GetCampTeam().GetSelectionMode() == GameOptionMode.automatric &&
            player.GetCampTeam().HasPlayerOk() &&
            !player.Locomotion.inHoldTug &&
            !player.Locomotion.isJoint &&
            playerToPass == null)
        {
            timeToSelect += Time.deltaTime;
            if (timeToSelect > 1.5f)
            {
                if (player.Distance(BallController.GetPosition()) > 3.5f || player.isOk == false) //Procurando jogador mais proximo
                {
                    PlayerController nearBall = GameManager.instance.GetPlayerNearBall(player.GetCampTeam());
                    if (nearBall != player)
                    {
                        speed = 0;
                        dir   = 0;

                        nearBall.SelectME();
                        timeToSelect = 0.0f;
                        return;
                    }
                }
            }
        }

        //Loockat na bola se estiver em strafe
        if (locomotion.inStrafe)
        {
            locomotion.ResetSpeedMultiples();
            Vector3 ballposition = BallController.GetPosition();
            ballposition.y = transform.position.y;
            transform.LookAt(ballposition);
        }

        //Gerenciamento de stamina
        if (locomotion.inSoccer)
        {
            SkillVar stamina = player.GetSkill_Stamina();
            stamina.mode = SkillVarMode.autoSubtract;
            if (stamina.IsMin || player.isOk == false)
            {
                player.GetSkill_Stamina().mode = SkillVarMode.autoRegen;
                locomotion.ResetSpeedMultiples();
                player.SetMotionNormal();
            }
        }

        //Para ações manuais se estiver tropeçando
        if (player.Locomotion.inStumble)//Tropeçando
        {
            locomotion.ResetSpeedMultiples();
            speed = 0;
            dir   = 0;
            return;
        }

        //Solicita avoid dos aliados a frente
        if (player.IsMyBall())
        {
            PlayerController allyBtw = null;
            if (player.IsHitForwad(5.5f, out allyBtw, player.GetCampTeam()))
            {
                if (allyBtw.IsLookAt(player))
                {
                    Vector3 origim  = allyBtw.transform.position + (-allyBtw.transform.forward * 4.5f);
                    Vector3 freePos = locomotion.GetRandomNavCircle(origim, 4.5f);
                    allyBtw.GetComponent <AIController>().GoToPosition(freePos, BallController.instance.transform);
                }
            }
        }

        //Se houver um jogador selecionado para o passe de bola vou esperar ficar distante que o jogador efetue alguma ação difernte de se mover
        //para remover a seleção do jogador a passar a bola
        if (playerToPass != null)
        {
            if (playerToPass.Distance(player) > 11.5f)
            {
                playerToPass = null;
                GameManager.instance.ResetIndicator();
            }
        }


        Vector2 move = locomotion.GetDirectionAxis1();

        dir   = move.x;
        speed = move.y;


        //Fill kick power amount
        if (ControllerInput.GetButtonDown(player.GetInputType(), player.GetInputs().Input_Kick))
        {
            //Fill kick power or fill action2 power
            SkillVar skillKick = player.GetSkill_BasicKick();


            if (player.IsMyBall())
            {
                skillKick.SetToggle();

                if (skillKick.IsReady)
                {
                    skillKick.mode = SkillVarMode.autoRegen;
                }
            }

            playerToPass = null;
            GameManager.instance.ResetIndicator();
        }
        //Kick ball
        if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Kick))
        {
            //Fill kick power if is myBall
            SkillVar skillKick = player.GetSkill_BasicKick();
            locomotion.ResetHoldTugAnimator();

            if (player.IsMyBall() && skillKick.isToggle)
            {
                if (skillKick.IsReady)
                {
                    if (locomotion.TriggerKick())
                    {
                        skillKick.TriggerCooldown();
                    }
                }
            }

            skillKick.mode = SkillVarMode.nothing;
            skillKick.SetCurrentValue(0);
            skillKick.ResetTogle();

            playerToPass = null;
            GameManager.instance.ResetIndicator();
        }

        //Soccer Motion
        if (ControllerInput.GetButton(player.GetInputType(), player.GetInputs().Input_Stamina))
        {
            SkillVar Stamina = player.GetSkill_Stamina();

            if (Stamina.IsCritical == false && player.isOk)
            {
                // playerToPass = null;
                //  GameManager.instance.ResetIndicator();
                player.SetMotionSoccer();
                player.Locomotion.SetSpeedMultiplies(1.2f);
            }
        }
        if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Stamina))
        {
            // playerToPass = null;
            // GameManager.instance.ResetIndicator();
            player.Locomotion.ResetSpeedMultiples();
            player.SetMotionNormal();
            player.GetSkill_Stamina().mode = SkillVarMode.autoRegen;
        }

        //Strafe Motion
        if (ControllerInput.GetButtonDown(player.GetInputType(), player.GetInputs().Input_Strafe))
        {
            // playerToPass = null;
            //  GameManager.instance.ResetIndicator();
            player.SetMotionStrafe();
            player.Locomotion.SetSpeedMultiplies(1.2f);
        }
        if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Strafe))
        {
            // playerToPass = null;
            // GameManager.instance.ResetIndicator();
            player.Locomotion.ResetSpeedMultiples();
            player.SetMotionNormal();
        }

        //Seleção para passe de bola
        if (ControllerInput.GetButton(player.GetInputType(), player.GetInputs().Input_Pass))
        {
            if (player.IsMyBall() == true && locomotion.inNormal)
            {
                Vector3 mdirection = transform.forward;
                List <PlayerController> players = player.GetPlayersNear(10.5f);

                if (players.Count > 0)
                {
                    PlayerController target = players.MinAngle(player, mdirection);
                    playerToPass = target;
                    GameManager.instance.IndicatePlayer(playerToPass);
                }
            }
        }
        //Rasteira
        if (ControllerInput.GetButtonDown(player.GetInputType(), player.GetInputs().Input_Pass))
        {
            if (player.IsMyBall() == false && locomotion.inNormal)
            {
                SkillVar skilltrack = player.GetSkill_BasicActionTwo();
                if (skilltrack.IsReady)
                {
                    if (locomotion.TriggerActionTwo())
                    {
                        skilltrack.TriggerCooldown();
                    }
                }
            }
        }

        //Passe de bola
        if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Pass))
        {
            //playerToPass = null;
            //GameManager.instance.ResetIndicator();
            SkillVar skillPass = player.GetSkill_BasicPass();
            if (skillPass.IsReady && player.IsMyBall())
            {
                if (locomotion.inNormal)
                {
                    if (locomotion.TriggerPass())
                    {
                        skillPass.TriggerCooldown();
                    }
                    else
                    {
                        playerToPass = null;
                        GameManager.instance.ResetIndicator();
                    }
                }
            }
            else
            {
                playerToPass = null;
                GameManager.instance.ResetIndicator();
            }
        }

        //JUMP
        if (ControllerInput.GetButtonDown(player.GetInputType(), player.GetInputs().Input_Jump))
        {
            locomotion.jump = true;
        }
        if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Jump))
        {
            locomotion.jump = false;
        }
    }
Exemplo n.º 13
0
    private void Handlle_NothingState()
    {
        if (Player.IsMyBall() == false)
        {
            aiState = SoccerAIState.nothing;
            return;
        }

        Transform        goalPosition = Player.GetEnemyGoalPosition();
        PlayerController playerBtw    = null;
        PlayerController enemyNear    = Player.GetEnemyNear();

        timeToDrible += Time.deltaTime;
        timeToGoal   += Time.deltaTime;


        if (toPass != null)
        {
            motionType = LocomotionType.normal;

            Debug.DrawLine(Player.transform.position, toPass.transform.position, Color.red);

            toGo = toPass.transform.position;

            if (Player.IsLookAt(toGo) == true)
            {
                if (Player.IsHitBetween(toPass) == false && Player.IsMyBall())
                {
                    if (Owner.TriggerPass(toPass))
                    {
                        Player.GetSkill_BasicPass().TriggerCooldown();
                        toPass = null;
                    }
                }
                else
                {
                    toPass = null;
                }
            }

            Move(toGo);
            return;
        }

        //Ativação de movimento soccer e uso de stamina
        if (enemyNear != null)
        {
            if (enemyNear.Distance(Player) <= 5.5f && enemyNear.IsSelected() && Player.isOk)
            {
                if (Player.GetSkill_Stamina().IsCritical == false)
                {
                    motionType = LocomotionType.soccer;
                }
                else if (Player.GetSkill_Stamina().IsMin)
                {
                    motionType = LocomotionType.normal;
                }
            }
            else
            {
                motionType = LocomotionType.normal;
            }
        }



        //Vou passar a bola se existir um cara livre entre e o gol. Esta e a prioridade ja q ele tem caminho livre
        if (Player.IsHitForwad(checkDistanceToPass, out playerBtw))
        {
            inGoalDir    = false;
            timeToDrible = 0.0f;

            if (playerBtw.IsMyTeaM(Player)) //Player e meu amigo, vou pedir para ele sair do caminho
            {
                if (playerBtw.IsLookAt(Player))
                {
                    Vector3 origim  = playerBtw.transform.position + (-playerBtw.transform.forward * 4.5f);
                    Vector3 freePos = Locomotion.GetRandomNavCircle(origim, 4.5f);
                    playerBtw.GetComponent <AIController>().GoToPosition(freePos, BallController.instance.transform);
                }
            }
            else if (playerBtw.Distance(Player) <= checkDistanceToDrible) //Player inimigo e perto de mais. Drible
            {
                if (Player.IsLookAt(toGo))
                {
                    Vector3 positionToDrible = Vector3.zero;

                    if (GetPositionToDrible(playerBtw, out positionToDrible))
                    {
                        toGo = positionToDrible;
                    }
                    else
                    {
                        //Se posição boa para o drible.
                        toGo = positionToDrible;
                    }
                }
            }
            else //Player inimigo mas longe de mais vou tentar um passe de bola
            {
                SkillVar         skillpass = Player.GetSkill_BasicPass();
                PlayerController topass    = null;
                if (GetToPass(out topass))
                {
                    if (Player.IsHitBetween(topass) == false && skillpass.IsReady)
                    {
                        toPass = topass;
                        toGo   = Player.transform.position;
                    }
                    else
                    {
                        inGoalDir = true;
                    }
                }
                else
                {
                    inGoalDir = true;
                }
            }
        }
        else
        {
            inGoalDir = true;

            if (enemyNear != null)
            {
                //Inimigo perto demais para ir pro gol. a probalidade de perder a bola e muito grande
                //Vou tentar um passe de bola
                SkillVar         skillpass = Player.GetSkill_BasicPass();
                PlayerController topass    = null;
                if (GetToPass(out topass) && skillpass.IsReady && enemyNear.IsSelected())
                {
                    if (!Player.IsHitBetween(topass))
                    {
                        toPass    = topass;
                        toGo      = Player.transform.position;
                        inGoalDir = false;
                    }
                }
                else
                {
                    //Nenhum player para tocar Assim sendo vou tentar driblar
                    if (enemyNear.Distance(Player) <= 1.0f && enemyNear.IsSelected())
                    {
                        if (timeToDrible >= 1.0f || Locomotion.IsAgentDone)
                        {
                            toGo         = Locomotion.GetRandomNavCircle(Player, 3.5f);
                            timeToDrible = 0;
                        }

                        inGoalDir = false;
                    }
                }
            }
        }

        if (inGoalDir) //Tudo livre para ir para o GOL
        {
            if (Locomotion.IsAgentDone || timeToGoal >= 1.5f)
            {
                toGo       = goalPosition.position;
                timeToGoal = 0;
            }
        }

        Move(toGo);
    }
Exemplo n.º 14
0
    private void Handle_FollowBallState()
    {
        //Corre atraz da bola se ela estiver a uma distancia aceitavel ou procura um jogador mais proximo
        //enquanto continua indo atraz da bola.
        //Ação finalizada se: Jogador deixar de estar selecionado ou pegar a bola

        if (Player.IsMyBall() || !Player.IsSelected())
        {
            Stop();
            aiState = SoccerAIState.nothing;
            return;
        }


        Vector3        goTotarget   = BallController.GetPosition();
        BallController ball         = BallController.instance;
        float          balldistance = ball.transform.Distance(Player.transform);


        //Ativa movimento soccer se tiver stamina e estiver muito longe da bola

        if (balldistance > 5.0f && Player.isOk)
        {
            if (Player.GetSkill_Stamina().IsCritical == false)
            {
                motionType = LocomotionType.soccer;
            }
            else if (Player.GetSkill_Stamina().IsMin)
            {
                motionType = LocomotionType.normal;
            }
        }
        else
        {
            motionType = LocomotionType.normal;
        }


        SkillVar skillTug  = Player.GetSkill_BasicActionOne();
        SkillVar skillTrak = Player.GetSkill_BasicActionTwo();

        //Ação Rasteira
        if (skillTrak.IsReady && Player.Locomotion.isJoint == false)
        {
            //Rasteira ou acao secundaria de poce de bola
            PlayerController enemyforward;

            if (Player.IsHitForwad(0.2f, out enemyforward, Player.GetCampTeam().Enemy()))
            {
                motionType = LocomotionType.normal;
                if (Locomotion.TriggerActionTwo())
                {
                    skillTrak.TriggerCooldown();
                }
            }
        }

        //Ação TugOfWar
        if (!skillTrak.IsReady && skillTug.IsReady && Player.Locomotion.isJoint == false)
        {
            PlayerController enemy = Player.GetEnemyNear();
            if (enemy != null)
            {
                if (enemy.Distance(Player) <= 1.5f && enemy.IsMyBall())
                {
                    Player.Locomotion.SetHoldTugAnimator();
                }
                else
                {
                    Player.Locomotion.ResetHoldTugAnimator();
                }
            }
        }
        else if (Player.Locomotion.isJoint)
        {
            Player.Locomotion.ResetHoldTugAnimator();
            goTotarget = Player.GetEnemyGoalPosition().position;

            if (skillTug.IsMax || Locomotion.JoitedPlayer.IsMyBall() == false)
            {
                skillTug.TriggerCooldown();
                skillTug.SetCurrentValue(0);
                Player.GetTugOfWar().RemoveJoint();
            }
        }
        //Verifica a distancia da bola, se estiver muito longe procuro outor jogador mais proximo para selecionar
        if (Player.GetCampTeam().GetSelectionMode() == GameOptionMode.automatric &&
            Player.GetCampTeam().HasPlayerOk() &&
            !Player.Locomotion.isJoint)
        {
            timeToSelect += Time.deltaTime;
            if (timeToSelect > 1.5f)
            {
                if (balldistance > 3.5f || Player.isOk == false) //Procurando jogador mais proximo
                {
                    PlayerController nearBall = GameManager.instance.GetPlayerNearBall(Player.GetCampTeam());
                    if (nearBall != Player)
                    {
                        nearBall.SelectME();
                        timeToSelect = 0.0f;
                    }
                }
            }
        }


        //Corre atraz do trajeto
        Agent.SetDestination(goTotarget);

        Vector2 move = Locomotion.GetDirectionAI();

        Speed     = move.y;
        Direction = move.x;
    }
Exemplo n.º 15
0
 public abstract void Initialzie(out SkillVar skillClone);
Exemplo n.º 16
0
 public override void Initialzie(out SkillVar skillClone)
 {
     skill.ability = this;
     skillClone    = (SkillVar)skill.Clone();
 }
Exemplo n.º 17
0
    // Update is called once per frame
    void Update()
    {
        SmootIKWeight();

        PlayerController mnPlayer;

        mnPlayer = player.GetPlayerNear();

        //Estica maos para o jogaodr mais proximo
        HandleHandsTo(mnPlayer);

        if (jointPlayer)
        {
            if (!player.isOk ||
                player.Locomotion.inStumble ||
                player.Locomotion.inTrack ||
                player.IsMyBall() ||
                !jointPlayer.isOk ||
                !player.GetSkill_BasicActionOne().IsReady

                )
            {
                RemoveJoint();
            }
        }
        else if (player.Locomotion.inHoldTug)
        {
            if (mnPlayer != null && !player.Locomotion.inAir && player.isOk && !mnPlayer.IsMyTeaM(player))
            {
                float dist = mnPlayer.Distance(player);
                if (dist <= tugWarDistance && dist > 0.5f && mnPlayer.isOk && !mnPlayer.Locomotion.inAir)
                {
                    //JOINT
                    player.Locomotion.JointTo(mnPlayer);
                    jointPlayer = mnPlayer;
                    jointPlayer.GetAnimatorEvents().OnChangeDirStart += EnemyOnChangeDir;
                }
            }
        }

        //CONTROLE MANUAL
        if (!player.IsIA)
        {
            if (player.IsMyBall() || player.isOk == false)
            {
                if (player.Locomotion.inHoldTug)
                {
                    player.Locomotion.ResetHoldTugAnimator();
                }
                player.GetSkill_BasicActionOne().mode = SkillVarMode.autoSubtract;
                return;
            }

            if (ControllerInput.GetButton(player.GetInputType(), player.GetInputs().Input_Kick) && player.isOk)
            {
                SkillVar skilltug = player.GetSkill_BasicActionOne();
                skilltug.SetToggle();


                if (skilltug.IsMax)
                {
                    skilltug.TriggerCooldown();
                }

                if (skilltug.IsReady)
                {
                    skilltug.mode = SkillVarMode.autoRegen;
                    if (jointPlayer == null)
                    {
                        player.Locomotion.SetHoldTugAnimator();
                    }
                    else
                    {
                        player.Locomotion.ResetHoldTugAnimator();
                    }
                }
                else
                {
                    skilltug.SetCurrentValue(0);
                    skilltug.mode = SkillVarMode.nothing;
                    player.Locomotion.ResetHoldTugAnimator();
                }
            }

            if (ControllerInput.GetButtonUp(player.GetInputType(), player.GetInputs().Input_Kick))
            {
                SkillVar skilltug = player.GetSkill_BasicActionOne();
                if (skilltug.isToggle == false)
                {
                    return;
                }

                skilltug.mode = SkillVarMode.autoSubtract;
                player.Locomotion.ResetHoldTugAnimator();
                skilltug.ResetTogle();

                if (skilltug.IsReady)
                {
                    RemoveJoint();
                }
            }
        }
    }