Пример #1
0
    private void FixedUpdate()
    {
        if (!RailwayDelimiteter.IsInsideLimits(cartRb.transform))
        {
            PopulationProxy.Instance.DeactivateAgent(this);
        }

        if (GetPoleRotPart() < PopulationProxy.Instance.removeAgentIfBelowAnglePart)
        {
            PopulationProxy.Instance.DeactivateAgent(this);
        }

        if (isAI && neuralGenome != null)
        {
            if (Time.time > lastRandomTorqueApplication + PopulationProxy.Instance.forceInterval)
            {
                lastRandomTorqueApplication = Time.time;

                var force =
                    PopulationProxy.Instance.force * PopulationProxy.Instance.forceMultiplier;
                poleRb.AddForce(Vector2.right *
                                GARandomManager.NextFloat(-force, force)
                                );
            }

            MoveFromNetwork();
            neuralGenome.Fitness += ComputeFitnessForThisTick();
        }
    }
 private void Awake()
 {
     instance = this;
 }