Пример #1
0
 public void Right()
 {
     if (!EmmitionEnabled)
     {
         return;
     }
     RightFoot.Play();
 }
Пример #2
0
    void Update()
    {
        //if (transform.rotation.eulerAngles.z > 90 && transform.rotation.eulerAngles.z < 270) Kill();

        //if (transform.position.x < -0.2f)
        //{
        //    net.SetFitness(-999);
        //    net.SetTimeAlive(-999);
        //    Kill();
        //}

        if (dontReward)
        {
            return;
        }

        if (netInitalized && manager.Countdown > 0)
        {
            if (_shouldPunish < 0)
            {
                _shouldPunish = 0;
            }

            float[] inputs =
            {
                HeadTransform.rotation.z,
                LeftArmTransform.rotation.z,
                RightArmTransform.rotation.z,
                LeftLegTransform.rotation.z,
                LeftFootTransform.rotation.z,
                RightLegTransform.rotation.z,
                RightFootTransform.rotation.z,
                _shouldPunish > 0f ? 100f : 0f,
                transform.position.x,
                Chest.transform.rotation.z,
                Chest.velocity.x,
                Chest.velocity.y,
                LeftLeg.velocity.x,
                LeftLeg.velocity.y,
                LeftLeg.angularVelocity,
                LeftFoot.velocity.x,
                LeftFoot.velocity.y,
                LeftFoot.angularVelocity,
                RightLeg.velocity.x,
                RightLeg.velocity.y,
                RightLeg.angularVelocity,
                RightFoot.velocity.x,
                RightFoot.velocity.y,
                RightFoot.angularVelocity,
                Vector2.Distance(new Vector2(transform.position.x, 0), new Vector2(WoD.Pos, 0))
            };

            float[] neurons = net.FeedForward(inputs);

            //HeadTransform.Rotate(Vector3.forward         , neurons[(int)Neuron.Head]);
            //LeftArmTransform.Rotate(Vector3.forward      , neurons[(int)Neuron.LeftArm]);
            //RightArmTransform.Rotate(Vector3.forward     , neurons[(int)Neuron.RightArm]);
            //LeftLegTransform.Rotate(Vector3.forward      , neurons[(int)Neuron.LeftLeg]);
            //LeftFootTransform.Rotate(Vector3.forward     , neurons[(int)Neuron.LeftFoot]);
            //RightLegTransform.Rotate(Vector3.forward     , neurons[(int)Neuron.RightLeg]);
            //RightFootTransform.Rotate(Vector3.forward    , neurons[(int)Neuron.RightFoot]);
            //ChestTransform.Rotate(Vector3.forward        , neurons[(int)Neuron.Torso]);

            Head.AddTorque(neurons[(int)Neuron.Head] * 5f, ForceMode2D.Force);
            LeftArm.AddTorque(neurons[(int)Neuron.LeftArm] * 5f, ForceMode2D.Force);
            RightArm.AddTorque(neurons[(int)Neuron.RightArm] * 5f, ForceMode2D.Force);
            LeftLeg.AddTorque(neurons[(int)Neuron.LeftLeg] * 20f, ForceMode2D.Force);
            LeftFoot.AddTorque(neurons[(int)Neuron.LeftFoot] * 20f, ForceMode2D.Force);
            RightLeg.AddTorque(neurons[(int)Neuron.RightLeg] * 20f, ForceMode2D.Force);
            RightFoot.AddTorque(neurons[(int)Neuron.RightFoot] * 20f, ForceMode2D.Force);
            Chest.AddTorque(neurons[(int)Neuron.Torso] * 5f, ForceMode2D.Force);

            if (_shouldPunish > 0)
            {
                if (killTimerValue > 0)
                {
                    killTimerValue -= Time.deltaTime;
                }
                else
                {
                    Kill();
                }
            }
            else
            {
                net.SetFitness(transform.position.x * 2);
                killTimerValue = killTimer;
            }

            net.SetTimeAlive(timeAlive);
            currentScore = net.GetFitness();

            lastPosition = transform.position.x;

            if (WoD.Pos >= transform.position.x)
            {
                Kill();
            }
        }

        timeAlive += Time.deltaTime;
    }
 public void SetUp()
 {
     _target = new RightFoot();
 }
 public RightLowerLimb()
 {
     RightFoot = new RightFoot();
 }
Пример #5
0
 public void setHero_RightFoot(RightFoot hero_RightFoot)
 {
     this.hero_RightFoot = hero_RightFoot;
 }
Пример #6
0
 public RightLowerLimb(RightFoot rightFoot)
 {
     _rightFoot = rightFoot;
 }