예제 #1
0
    //Initilization
    protected override void Start()
    {
        //start living entity base class
        base.Start();
        startingHealth = baseHealth;
        switch (dietinfo)
        {
        case 'h':
            dietType = Diet.Herbivorous;
            break;

        case 'o':
            dietType = Diet.Omnivorous;
            break;

        case 'p':
            dietType = Diet.Carnivorous;
            break;
        }

        //Action marker setup
        skinDefalt  = GetComponent <Renderer>().material;
        defaltColor = skinDefalt.color;

        //navagation set up
        pathfinder = GetComponent <NavMeshAgent>();
        pathfinder.acceleration = acceleration;
        pathfinder.speed        = movmentSpeed;

        currentState      = State.Idle;
        currentTargetList = new List <Transform>();
        currentTargetType = targetType.Water;

        //Combat set up
        animatCombat            = GetComponent <Combat>();
        attackDistanceThreshold = attackRange / 1.2f;
        animatCombat.SetStats(attackRange, attackAccuracy, attackDamage);

        //Sence Components set up
        //sight
        animatSight = GetComponent <Sight>();
        animatSight.SetStats(sightRange);

        //olfaction
        animatOlfaction = GetComponent <Olfaction>();
        animatOlfaction.SetStats(olfactionRange, olfactionAccuracy);

        //audition
        animatAudition = GetComponent <Audition>();
        animatAudition.SetStats(hearingRange);

        //Metabolism
        hunger = (int)(baseSatation / 1.5);
        thirst = (int)(baseHydration / 1.5);
        StartCoroutine(Metabolism());

        //Cognition
        spawnOrigin         = GetComponentInParent <Spawner>();
        noOfTargetsConsumed = 0;
        StartCoroutine(DecisionBlock());
        StartCoroutine(ActionBlock());
    }
예제 #2
0
    //Initilization
    protected override void Start()
    {
        //start living entity base class
        base.Start();
        startingHealth = baseHealth;
        switch (dietinfo) {
            case 'h':
                dietType = Diet.Herbivorous;
                break;
            case 'o':
                dietType = Diet.Omnivorous;
                break;
            case 'p':
                dietType = Diet.Carnivorous;
                break;
        }

        //Action marker setup
        skinDefalt = GetComponent<Renderer>().material;
        defaltColor = skinDefalt.color;

        //navagation set up
        pathfinder = GetComponent<NavMeshAgent>();
        pathfinder.acceleration = acceleration;
        pathfinder.speed = movmentSpeed;

        currentState = State.Idle;
        currentTargetList = new List<Transform>();
        currentTargetType = targetType.Water;

        //Combat set up
        animatCombat = GetComponent<Combat>();
        attackDistanceThreshold = attackRange / 1.2f;
        animatCombat.SetStats(attackRange, attackAccuracy, attackDamage);

        //Sence Components set up
        //sight
        animatSight = GetComponent<Sight>();
        animatSight.SetStats(sightRange);

        //olfaction
        animatOlfaction = GetComponent<Olfaction>();
        animatOlfaction.SetStats(olfactionRange, olfactionAccuracy);

        //audition
        animatAudition = GetComponent<Audition>();
        animatAudition.SetStats(hearingRange);

        //Metabolism
        hunger = (int)(baseSatation/1.5);
        thirst = (int)(baseHydration/1.5);
        StartCoroutine(Metabolism());

        //Cognition
        spawnOrigin = GetComponentInParent<Spawner>();
        noOfTargetsConsumed = 0;
        StartCoroutine(DecisionBlock());
        StartCoroutine(ActionBlock());    

    }