示例#1
0
    protected override void GeneUpdate()
    {
        Own.RotateTo(Own.CurrentTile.ToVector3());
        if (Vector3.Distance(Own.Tr.position, Own.CurrentTile.ToVector3()) > Own.Params.BodyParam.MinDistanceToAny)
        {
            Own.Behaviors.StopAction();
        }
        float hungerDown = Own.Params.JawsParam.HungerDown;
        float bite       = Own.Params.BodyParam.GetSize() * 0.05f; //Bite 5% from own size

        if (Own.CurrentTile.AgePlant < bite)
        {
            hungerDown = ((bite - Own.CurrentTile.AgePlant) / bite) * hungerDown;
            Own.CurrentTile.AgePlant = 0;
            Own.Behaviors.StopAction();
        }
        else
        {
            Own.CurrentTile.AgePlant -= bite;
            if (Own.Conditions.GetContition <Hunger>().Increase(hungerDown) == 0)
            {
                Own.Behaviors.StopAction();
            }
        }
        arrPlantChunks[Own.CurrentTile.X / Own.Map.sizeChunk, Own.CurrentTile.Z / Own.Map.sizeChunk].ReBuildMesh();
    }
示例#2
0
 public override void Start()
 {
     if (Own.Gender == GenderType.Boy)
     {
         particle.Play();
         Pair = Own.Behaviors.GetBehavior <FindPair>().Pair;
         Pair.Behaviors.GetBehavior <Pairing>().Pair = Own;
         Pair.Behaviors.StartAction <Pairing>();
     }
     Own.RotateTo(Pair.Tr.position);
     time = 0;
 }
示例#3
0
    void MoveTo(Vector3 next)
    {
        //Gravity();
        Own.RotateTo(next);

        if (!Own.IsGrounded)
        {
            //Own.Rb.AddForce(Own.Tr.forward * 0.1f);
        }
        else
        {
            Own.Rb.MovePosition(Own.Tr.position + Own.Tr.forward * 0.01f);
            //Own.Rb.velocity = Own.Tr.forward * Own.Params.BodyParam.GetSpeed();
            //Own.Tr.position+=(Own.Tr.forward * 0.0001f);
        }
    }