Beispiel #1
0
    //preparing :

    private void InitNeeds()
    {
        needs = new List <NeedObject>();
        NeedObject n1 = ScriptableObject.CreateInstance <NeedObject>();

        n1.SetNeedObjectValues(activities.bladder);
        needs.Add(n1);

        NeedObject n2 = ScriptableObject.CreateInstance <NeedObject>();

        n2.SetNeedObjectValues(activities.energy);
        needs.Add(n2);

        NeedObject n3 = ScriptableObject.CreateInstance <NeedObject>();

        n3.SetNeedObjectValues(activities.fun);
        needs.Add(n3);

        NeedObject n4 = ScriptableObject.CreateInstance <NeedObject>();

        n4.SetNeedObjectValues(activities.hunger);
        needs.Add(n4);

        NeedObject n5 = ScriptableObject.CreateInstance <NeedObject>();

        n5.SetNeedObjectValues(activities.hygiene);
        needs.Add(n5);

        //NeedObject n6 = ScriptableObject.CreateInstance<NeedObject>();
        //n6.SetNeedObjectValues(activities.social);
        //needs.Add(n6);
        doing = idle.searching;
        anim.Play("walking");
    }
Beispiel #2
0
 private void Start()
 {
     _state = new State();
     _idle  = new idle();
     _eat   = new eat();
     _run   = new run();
 }
Beispiel #3
0
    public static event Action <EnemyBehaviour> OnDie; //Send message to game manager, might be sent from player

    void Start()                                       //or Awake()? or OnEnable()?
    {
        player         = GameObject.FindWithTag("Player");
        enemyRB        = GetComponent <Rigidbody2D>();
        moveLeft       = new moveLeft();
        moveRight      = new moveRight();
        idle           = new idle();
        jump           = new jump();
        moveToLocation = new moveToLocation();
        //add behavior to command list
        patrolingBehaviorCommands.Add(moveLeft);
        patrolingBehaviorCommands.Add(moveLeft);
        patrolingBehaviorCommands.Add(moveLeft);
        patrolingBehaviorCommands.Add(moveLeft);
        patrolingBehaviorCommands.Add(moveLeft);
        patrolingBehaviorCommands.Add(moveRight);
        patrolingBehaviorCommands.Add(moveRight);
        patrolingBehaviorCommands.Add(moveRight);
        patrolingBehaviorCommands.Add(moveRight);
        patrolingBehaviorCommands.Add(moveRight);

        //chaseBehaviorCommands.Add(moveToLocation);

        patrolSlot = maxPatrolSlot;
        chaseSlot  = maxChaseSlot;
        Invoke("EnemyPatrol", UnityEngine.Random.Range(0.2f, 2f));  //Cheat to make the goombas behave not in unison
    }
Beispiel #4
0
    void Start()
    {
        foreach (IReaction <GameObject> enemy in enemies)
        {
            enemieAlert += enemy.Chase;
            allEnemies  += 1;
        }

        foreach (IReaction <GameObject> enemy in enemies)
        {
            enemieIdle += enemy.Idle;
        }
    }
Beispiel #5
0
 private void StateCalculator()
 {
     if (targetObject != null)
     {
         if (doing is idle.searching && IsByActivity() && !targetObject.getStatus())
         {
             targetObject.setOcuppied();
             activity_counter = targetObject.getDurration();
             // printToDebug("activity counet init: " + activity_counter, 218);
             path.Clear();
             doing = idle.using_activity;
         }
         if (doing is idle.using_activity && activity_counter == 0)
         {
             targetObject.setUnOcuppied();
             doing = idle.searching;
         }
     }
 }