Ejemplo n.º 1
0
    public void SpawnHumanoid(HumanoidType type)
    {
        switch (type)
        {
        case HumanoidType.Human:
            SpawnHuman();
            break;

        case HumanoidType.Zombie:
            SpawnZombies();
            break;

        default:
            break;
        }
    }
    public HumanoidStateMachine(Transform pTransform, HumanoidType pHumanoidType, BehaviourType pBehaviour, float startHealth)
    {
        this._myTransform = pTransform;
        this._timeToChange = TIMETOCHANGE;
        this._startHeath=startHealth;

        this._humanoidType = pHumanoidType;
        this._behaviour = pBehaviour;
        if (this._behaviour == BehaviourType.DEFAULT) this._currentState = FiniteStateMachineType.IDLE;
        else this._currentState = FiniteStateMachineType.PATROL;

        this._target = GameObject.FindGameObjectWithTag("Player").transform;
        this._navigationMesh = new HumanoidNavigationMesh(this._myTransform, this._target, this._myTransform.GetComponent<NavMeshAgent>(), this._behaviour);

        this._gunObject = this._myTransform.FindChild("Gun").gameObject;
        this._gun = new HumanoidGun(this._gunObject);
    }