示例#1
0
文件: Mating.cs 项目: jei-W/duckFarm
    public override void Update()
    {
        base.Update();

        if ("matingWithPartner" == currentState)
        {
            owner.ChangeState("Idle");
            return;
        }

        if (partner == null)
        {
            owner.ChangeState("Idle");
            return;
        }

        owner.Move(partner.transform.position);

        if ((partner.transform.position - owner.transform.position).sqrMagnitude < owner.recognitionDistance)
        {
            isReadyMakeEgg = true;
            switch (partner.GetCurrentStateName())
            {
            case "Idle":
                //상대오리의 발정확률을 증가시킨다
                partner.ChangeTargetValue(partner.CurrentHeat, 10.0f);
                break;

            case "Mating":
                // 파트너가 메이팅이지만, 아직 준비가 덜 됬을 수도 있다.
                // 파트너가 알 만들 준비를 끝냈는지? 물어봐야한다.
                Mating partnerState = partner.GetCurrentState() as Mating;
                if (partnerState.IsReadyMakeEgg() && isReadyMakeEgg)
                {
                    //알만들기 한다
                    ChangeMatingState("matingWithPartner");
                }
                break;

            default:
                partner = World.GetInstance().FindCloseOppositeSexDuck(owner);
                break;
            }
        }
    }
示例#2
0
文件: State.cs 项目: jei-W/duckFarm
 public virtual void Update()
 {
     owner.Hunger  = owner.ChangeTargetValue(owner.Hunger, hungerChangeValue);
     owner.Fatigue = owner.ChangeTargetValue(owner.Fatigue, fatigueChangeValue);
 }