Ejemplo n.º 1
0
    private void FixedUpdate()
    {
        if (Vector3.Distance(_targetPosition, transform.position) < 0.1f) //super near target
        {
            RandomizeTargetPosition();
        }
        transform.LookAt(_targetPosition);

        _unitControler.InputControl(0f, 1f);
    }
Ejemplo n.º 2
0
    public override void AgentAction(float[] vectorAction, string textAction)
    {
        _timer += Time.fixedDeltaTime;
        float h = Mathf.Clamp(vectorAction[0], -1f, 1f);
        float v = Mathf.Clamp(vectorAction[1], -1f, 1f);

        if (float.IsNaN(h) || float.IsNaN(v))
        {
            return;
        }

        _controler.InputControl(h, v);

        //assign awards

        //end reward
        NotFallOffTheEdge();
        GetToGoal();

        if (_deadFlag)
        {
            return;
        }
        //HealthControl();
        //TurretsWithinRange();
        //CurrentStatus();
        TimeConstraint();
        //NearByFriendlyUnits();
        //DistanceToGoal();
        IsWalkingToGoal();
        IsFacingGoal();
        _previousPos = _enemy.transform.position;
        _prevForward = _enemy.transform.forward;

        //Monitor.Log("reward", GetCumulativeReward(), _enemy.transform, Camera.main);
    }
Ejemplo n.º 3
0
 private void FixedUpdate()
 {
     _playerControler.InputControl(Input.GetAxis("Horizontal"), Input.GetAxis("Vertical"));
 }