Exemple #1
0
 private void OnCaseChanged(object sender, CaseChangedEventArgs e)
 {
     if (e.state == Case.DEATH)
     {
         ai.OnCaseChanged(new CaseChangedEventArgs(null, Case.RESET));
         Death();
     }
 }
Exemple #2
0
 public void OnCaseChanged(object sender, CaseChangedEventArgs e)
 {
     if (e.state == Case.AVAILABLE)
     {
         ai.currentState = Case.AVAILABLE;
         Decision();
     }
 }
Exemple #3
0
 public void OnCaseChanged(object sender, CaseChangedEventArgs e)
 {
     if (e.state == Case.WANDER)
     {
         ai.currentState = Case.WANDER;
         Run();
         Wander();
     }
 }
Exemple #4
0
 private void OnCaseChanged(object sender, CaseChangedEventArgs e)
 {
     if (e.state == Case.AVAILABLE)
     {
         CaseContainer.Adjust(ai.caseDatas, Case.FLEE, flee ? 1 : 0);
     }
     else if (e.state == Case.IDENTITY_UPDATE)
     {
         vision = ai.Identity.Vision;
     }
 }
Exemple #5
0
 private void OnCaseChanged(object sender, CaseChangedEventArgs e)
 {
     if (e.state == Case.GROWTH)
     {
         print("1");
         StartCoroutine(Growth());
     }
     else if (e.state == Case.RESET)
     {
         phase  = phaseCount;
         growth = 0;
     }
 }
Exemple #6
0
    public void OnCaseChanged(object sender, CaseChangedEventArgs e)
    {
        if (e.state == Case.IDLE)
        {
            defaultTime = idleTime;

            if (e.data != null)
            {
                e.data.SetData(this);
            }
            else
            {
                tempTime = defaultTime;
            }

            ai.currentState = Case.IDLE;
            ai.Stop();
            Run();
        }
    }
Exemple #7
0
    private void OnCaseChanged(object sender, CaseChangedEventArgs e)
    {
        if (e.state == Case.REPRODUCTION)
        {
            if (e.data != null)
            {
                e.data.SetData(this);
            }

            if (target == null)
            {
                target = FindPartner();
            }

            if (target != null)
            {
                ai.currentState = Case.REPRODUCTION;
                Run();
            }
            else
            {
                ai.HandleSpeed(SpeedPhase.WALK);
                ai.OnCaseChanged(new CaseChangedEventArgs(null, Case.WANDER));
            }
        }
        else if (e.state == Case.AVAILABLE)
        {
            CaseContainer.Adjust(ai.caseDatas, Case.REPRODUCTION, reproductionUrge);
        }
        else if (e.state == Case.IDENTITY_UPDATE)
        {
            UpdateData();
        }
        else if (e.state == Case.RESET)
        {
            reproductionUrge = 0;
            alerted          = false;
            isRunning        = false;
            canReproduce     = false;
        }
    }
Exemple #8
0
    public void OnCaseChanged(object sender, CaseChangedEventArgs e)
    {
        print(e.state);

        if (e.state == Case.HUNGER)
        {
            if (e.data != null)
            {
                SetReportedData(e.data);
                return;
            }

            target = FindFood();
            if (target != null)
            {
                ai.currentState = Case.HUNGER;
                Run();
            }
            else
            {
                ai.HandleSpeed(SpeedPhase.WALK);
                ai.OnCaseChanged(new CaseChangedEventArgs(null, Case.WANDER));
            }
        }
        else if (e.state == Case.IDENTITY_UPDATE)
        {
            vision = ai.Identity.Vision;
            print("1");
        }
        else if (e.state == Case.AVAILABLE)
        {
            CaseContainer.Adjust(ai.caseDatas, Case.HUNGER, hunger);
        }
        else if (e.state == Case.RESET)
        {
            isRunning = false;
            hunger    = 0;
            alerted   = false;
        }
    }
Exemple #9
0
    public void OnCaseChanged(object sender, CaseChangedEventArgs e)
    {
        if (e.state == Case.THIRST)
        {
            if (e.data != null)
            {
                SetReportedData(e.data);
                return;
            }

            target = FindWater();
            if (target != null)
            {
                ai.currentState = Case.THIRST;
                Run();
                _animationManager.SetState(AnimationType.Walk);
                ai.Move(target.position);
            }
            else
            {
                ai.HandleSpeed(SpeedPhase.WALK);
                ai.OnCaseChanged(new CaseChangedEventArgs(null, Case.WANDER));
            }
        }
        else if (e.state == Case.IDENTITY_UPDATE)
        {
            vision = ai.Identity.Vision;
        }
        else if (e.state == Case.AVAILABLE)
        {
            CaseContainer.Adjust(ai.caseDatas, Case.THIRST, thirst);
        }
        else if (e.state == Case.RESET)
        {
            thirst    = 0;
            alerted   = false;
            isRunning = false;
            target    = null;
        }
    }