コード例 #1
0
ファイル: DoneEnemyAI.cs プロジェクト: penfei/mas_prototype
    private int wayPointIndex; // A counter for the way point array.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setting up the references.
        enemySight = GetComponent<DoneEnemySight>();
        nav = GetComponent<NavMeshAgent>();
        //		player = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        //		playerHealth = player.GetComponent<DonePlayerHealth>();
        //		lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>();
    }
コード例 #2
0
ファイル: DoneEnemyAI.cs プロジェクト: C0DEF52/Stealth
    private int wayPointIndex;                                          // A counter for the way point array.


    void Awake()
    {
        // Setting up the references.
        enemySight         = GetComponent <DoneEnemySight>();
        nav                = GetComponent <NavMeshAgent>();
        player             = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        playerHealth       = player.GetComponent <DonePlayerHealth>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneLastPlayerSighting>();
    }
コード例 #3
0
ファイル: DoneEnemyAI.cs プロジェクト: umbarger/Stealth
    private int wayPointIndex; // A counter for the way point array.

    #endregion Fields

    #region Methods

    void Awake()
    {
        // Setting up the references.
        enemySight = GetComponent<DoneEnemySight>();
        nav = GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        playerHealth = player.GetComponent<DonePlayerHealth>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>();

        // initializing the current_behavior variable
        current_behavior = "Initializing";
    }
コード例 #4
0
    private Transform player; // Reference to the player's transform.

    #endregion Fields

    #region Methods

    //    private DoneHashIDs hash;					// Reference to the HashIDs script.
    //    private DoneAnimatorSetup animSetup;		// An instance of the AnimatorSetup helper class.
    void Awake()
    {
        // Setting up the references.
        //		player = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        enemySight = GetComponent<DoneEnemySight>();
        nav = GetComponent<NavMeshAgent>();
        anim = GetComponent<Animator>();
        //		hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>();

        // Making sure the rotation is controlled by Mecanim.
        nav.updateRotation = false;

        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        //		animSetup = new DoneAnimatorSetup(anim, hash);

        // Set the weights for the shooting and gun layers to 1.
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        // We need to convert the angle for the deadzone from degrees to radians.
        deadZone *= Mathf.Deg2Rad;
    }
コード例 #5
0
    void Awake()
    {
        // Setting up the references.
        enemySight         = GetComponent <DoneEnemySight>();
        nav                = GetComponent <NavMeshAgent>();
        player             = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        playerHealth       = player.GetComponent <Health>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneLastPlayerSighting>();

        if (bloodPrefab)
        {
            // if (damageEffectTransform == gameObject.transform)
            damageEffectTransform = transform;
            GameObject effect = Spawner.Spawn(bloodPrefab, Vector3.zero, Quaternion.identity);
            effect.transform.parent        = damageEffectTransform;
            effect.transform.localPosition = Vector3.zero;
            damageEffect = effect.GetComponent <ParticleEmitter>();
            Vector2 tempSize = new Vector2(GetComponent <Collider>().bounds.extents.x, GetComponent <Collider>().bounds.extents.z);
            colliderRadiusHeuristic   = tempSize.magnitude * 0.5f;
            damageEffectCenterYOffset = GetComponent <Collider>().bounds.extents.y;
        }
    }
コード例 #6
0
    private DoneAnimatorSetup animSetup;                // An instance of the AnimatorSetup helper class.


    void Awake()
    {
        // Setting up the references.
        player     = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        enemySight = GetComponent <DoneEnemySight>();
        nav        = GetComponent <NavMeshAgent>();
        anim       = GetComponent <Animator>();
        hash       = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent <DoneHashIDs>();

        // Making sure the rotation is controlled by Mecanim.
        nav.updateRotation = false;

        // Creating an instance of the AnimatorSetup class and calling it's constructor.
        animSetup = new DoneAnimatorSetup(anim, hash);

        // Set the weights for the shooting and gun layers to 1.
        anim.SetLayerWeight(1, 1f);
        anim.SetLayerWeight(2, 1f);

        // We need to convert the angle for the deadzone from degrees to radians.
        deadZone *= Mathf.Deg2Rad;
    }
コード例 #7
0
    void Awake()
    {
        // Setting up the references.
        enemySight = GetComponent<DoneEnemySight>();
        nav = GetComponent<NavMeshAgent>();
        player = GameObject.FindGameObjectWithTag(DoneTags.player).transform;
        playerHealth = player.GetComponent<Health>();
        lastPlayerSighting = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneLastPlayerSighting>();

        if (bloodPrefab)
        {
           // if (damageEffectTransform == gameObject.transform)
                damageEffectTransform = transform;
            GameObject effect = Spawner.Spawn(bloodPrefab, Vector3.zero, Quaternion.identity);
            effect.transform.parent = damageEffectTransform;
            effect.transform.localPosition = Vector3.zero;
            damageEffect = effect.GetComponent<ParticleEmitter>();
            Vector2 tempSize = new Vector2(GetComponent<Collider>().bounds.extents.x, GetComponent<Collider>().bounds.extents.z);
            colliderRadiusHeuristic = tempSize.magnitude * 0.5f;
            damageEffectCenterYOffset = GetComponent<Collider>().bounds.extents.y;

        }
    }
コード例 #8
0
    void Awake()
    {
        counter = 0;
        incorrect_counter = 0;
        filename = "collision_eval.txt";
        time_stat_file = "time_stats.txt";
        write_once = false;
        self = this.transform;
        self_ai = this.GetComponent<DoneEnemyAI>();
        self_sight = this.GetComponent<DoneEnemySight>();
        player = GameObject.FindGameObjectWithTag(DoneTags.player);
        player_health = player.GetComponent<DonePlayerHealth>();
        animator_hash = GameObject.FindGameObjectWithTag(DoneTags.gameController).GetComponent<DoneHashIDs>();

        GameObject[] enemies = GameObject.FindGameObjectsWithTag(DoneTags.enemy);
        for( int i = 0; i < enemies.Length; i++)
        {
            if ( self.transform == enemies[i].transform)
            {
                enemy_num = i + 1;
            }
        }
    }