Example #1
0
    // Use this for initialization
    void Start()
    {
        if (!isForCinematic)
        {
            GameManager.iaManager.registerIA(this);
        }
        despawned            = false;
        attackController     = GetComponent <CharacterAttackController> ();
        isOnGuard            = false;
        iaAnimator           = GetComponentInChildren <Animator> ();
        player               = GameManager.player;
        characterController  = GetComponent <CharacterController> ();
        transform.forward    = new Vector3(1f, 0f, 0f);
        minimumDistanceFront = ((Random.value) * 0.2f) + 0.2f;

        isDead = false;
        walkOnMultiplePaths = GetComponent <WalkOnMultiplePaths> ();

        enemyOnHitParticlesController = GetComponent <EnemyOnHitParticlesController> ();
        //Particle Inicialization
        //hitParticles = new GameObject[3];

        //hitParticles[0] = GameObject.Instantiate (onHitEffect) as GameObject;
        //hitParticles[1] = GameObject.Instantiate (secondOnHitEffect) as GameObject;
        //hitParticles[2] = GameObject.Instantiate (thirdOnHitEffect) as GameObject;
        flyParticles = GameObject.Instantiate(flySmokeParticles) as GameObject;
        flyParticles.transform.parent   = transform;
        flyParticles.transform.position = GetComponent <Rigidbody> ().worldCenterOfMass;
        hitGroundParticles = GameObject.Instantiate(onHitGroundParticles) as GameObject;
        hitGroundParticles.transform.parent   = transform;
        hitGroundParticles.transform.position = GetComponent <Rigidbody> ().worldCenterOfMass;

        /*foreach (GameObject particles in hitParticles) {
         *      particles.transform.parent = gameObject.transform;
         * }*/
    }
    // Use this for initialization
    void Start()
    {
        if(!isForCinematic){
            GameManager.iaManager.registerIA (this);
        }
        despawned = false;
        attackController = GetComponent<CharacterAttackController> ();
        isOnGuard = false;
        iaAnimator = GetComponentInChildren<Animator> ();
        player = GameManager.player;
        characterController = GetComponent<CharacterController> ();
        transform.forward = new Vector3(1f,0f,0f);
        minimumDistanceFront = ((Random.value)*0.2f) + 0.2f;

        isDead = false;
        walkOnMultiplePaths = GetComponent<WalkOnMultiplePaths> ();

        enemyOnHitParticlesController = GetComponent<EnemyOnHitParticlesController> ();
        //Particle Inicialization
        //hitParticles = new GameObject[3];

        //hitParticles[0] = GameObject.Instantiate (onHitEffect) as GameObject;
        //hitParticles[1] = GameObject.Instantiate (secondOnHitEffect) as GameObject;
        //hitParticles[2] = GameObject.Instantiate (thirdOnHitEffect) as GameObject;
        flyParticles = GameObject.Instantiate (flySmokeParticles) as GameObject;
        flyParticles.transform.parent = transform;
        flyParticles.transform.position = GetComponent<Rigidbody> ().worldCenterOfMass;
        hitGroundParticles = GameObject.Instantiate (onHitGroundParticles) as GameObject;
        hitGroundParticles.transform.parent = transform;
        hitGroundParticles.transform.position = GetComponent<Rigidbody> ().worldCenterOfMass;

        /*foreach (GameObject particles in hitParticles) {
            particles.transform.parent = gameObject.transform;
        }*/
    }