コード例 #1
0
 public override void OnStateUpdate()
 {
     attackDuration -= Time.deltaTime;
     if (attackDuration <= 0)
     {
         //Entity.ChangeState(typeof(assNavigationState));
         Entity.AIThinkingNextState(Entity.AIType, Entity.MediumOffsetThinkReset);
     }
 }
コード例 #2
0
    public override void OnStateUpdate()
    {
        Entity.AnimCtrl.SetFloat("yVelocity", Entity.RgdBdy2D.velocity.y);
        //Entity.AnimCtrl.SetBool("on_ground", Entity.OnGround);

        if (randomMove)
        {
            if (Vector2.Distance(Entity.RgdBdy2D.position, randLocation) < Entity.DistanceTreshold)
            {
                Entity.AIThinkingNextState(Entity.AIType, Entity.ShortOffsetThinkResetTime);
                return;
            }
            Entity.RgdBdy2D.position = Vector2.MoveTowards(Entity.RgdBdy2D.position, randLocation,
                                                           Entity.MinMaxMoveSpeed.x * Time.deltaTime);

            Vector2 direction = ((Vector2)randLocation - Entity.RgdBdy2D.position).normalized;
            Entity.RotateEntity(direction.x);
        }
    }