Esempio n. 1
0
    void Start()
    {
        navMeshAgent = GetComponentInChildren <NavMeshAgent>();
        timer        = GameObject.FindGameObjectWithTag("GameController").GetComponent <Timer>();
        zombieAudio  = GetComponent <ZombieAudio>();
        if (navMeshAgent == null)
        {
            Debug.LogError("We need a navmesh to traverse the world with");
            enabled = false;
        }
        if (navMeshAgent.transform == this.transform)
        {
            Debug.LogError("The navmesh agent should be a child of the character");
            enabled = false;
        }

        navMeshAgent.speed        = 0;
        navMeshAgent.acceleration = 0;
        sight.sightLayers         = LayerMask.GetMask("Rigdoll");

        if (navMeshAgent.stoppingDistance == 0)
        {
            //Debug.Log("Auto settings stoppoing distance to 0.3f");
            navMeshAgent.stoppingDistance = 1.5f;
        }
        GetAllCharacter();
    }
Esempio n. 2
0
    private ZombieAIState zombieState;       //基类对象

    #endregion

    void Start()
    {
        zombieAudio = GetComponent <ZombieAudio>();
        //初始化navMeshAgent
        navMeshAgent = GetComponentInChildren <NavMeshAgent>();
        if (navMeshAgent == null)
        {
            Debug.LogError("We need a navmesh to traverse the world with");
            enabled = false;
        }
        if (navMeshAgent.transform == this.transform)
        {
            Debug.LogError("The navmesh agent should be a child of the character");
            enabled = false;
        }
        navMeshAgent.speed        = 0;
        navMeshAgent.acceleration = 0;
        sight.sightLayers         = LayerMask.GetMask("Rigdoll");
        if (navMeshAgent.stoppingDistance == 0)
        {
            //Debug.Log("Auto settings stoppoing distance to 0.3f");
            navMeshAgent.stoppingDistance = 1.5f;
        }
        InitializeAIState();
        //获取所有玩家对象
        GetAllCharacter();
    }
Esempio n. 3
0
    // Use this for initialization
    void Start()
    {
        animator            = GetComponent <Animator>();
        zombieAI            = GetComponent <ZombieAI>();
        zombieAudio         = GetComponent <ZombieAudio>();
        bodyParts           = GetComponentsInChildren <Rigidbody>();
        zombieMovement      = GetComponent <ZombieMovement>();
        characterController = GetComponent <CharacterController>();

        EnableRagdoll(false);
    }