コード例 #1
0
    public override void Execute()
    {
        if (_leader)
        {
            _leader.Idle();

            if (_leader.currentHP <= _leader.currentHP / 4)
            {
                _leaderFlags.lowHP = true;
            }
            else
            {
                _leaderFlags.lowHP = false;
                Vector3 enemyTeamCenter = _leader.EnemyTeamCenter();
                if ((enemyTeamCenter - _leader.transform.position).magnitude > _leader.leadStopDistance)
                {
                    _leaderFlags.inMiddle = false;
                }
            }
            _leader.rb.isKinematic = false;
        }

        if (_follower)
        {
            _follower.Idle();

            if (_follower.currentHP <= _follower.currentHP / 4)
            {
                _followerFlags.lowHP = true;
            }
            else
            {
                _followerFlags.lowHP = false;
                if (_follower.DistanceToLeader() <= _follower.stopDist)
                {
                    _followerFlags.isCloseToLeader = true;
                }

                else
                {
                    _followerFlags.isCloseToLeader = false;
                }
            }
            _follower.rb.isKinematic = false;
        }
        _treeStart.Execute();
    }
コード例 #2
0
    public override void Execute()
    {
        _leader.mesh.material = _leader.defaultMaterial;
        //Obtengo el punto para poder calcular la distancia
        Vector3 enemyTeamCenter = _leader.EnemyTeamCenter();

        if ((enemyTeamCenter - _leader.transform.position).magnitude <= _leadStopDistance)
        {
            _flags.inMiddle = true;
        }
        else
        {
            _flags.inMiddle = false;
        }

        if (_flags.inMiddle == false)
        {
            _leader.Move();
        }
        else
        {
            _treeStart.Execute();
        }
    }