// Use this for initialization
    void Start()
    {
        //maxRayDistance = 20;
        anim = gameObject.GetComponent <Animator>();
        particleHolder.SetActive(false);

        agent = gameObject.GetComponentInParent <NavMeshAgent>();
        if (!agent)
        {
            agent = gameObject.transform.parent.root.GetComponent <NavMeshAgent>();
        }
        if (!agent)
        {
            agent = gameObject.transform.parent.root.GetComponentInChildren <NavMeshAgent>();
        }
        growlIndex = Random.Range(0, growls.Length);


        currentgrowl = growls[growlIndex];

        growlscript = GameObject.FindGameObjectWithTag("GrowlManager").GetComponent <GrowlManager>();

        levelMultiplier = LevelProgression.MasterLevelMultiplier;
        if (levelMultiplier == 0)
        {
            levelMultiplier = 1;
        }
        enemyStrength = 5 * levelMultiplier;
        if (attackDistance == 0)
        {
            attackDistance = 4;
        }
        soundhashInd = Random.Range(0, growls.Length);
        polypRB      = gameObject.GetComponent <Rigidbody>();



        character   = GetComponent <ThirdPersonCharacter>();
        clipPlaying = false;

        m_playerdied = GameObject.Find("DeathManager").GetComponent <PlayerDied>();
        if (!randomize)
        {
            waypointInd = 0;
        }

        if (randomize)
        {
            waypoints   = GameObject.FindGameObjectsWithTag("BossNavPoints");
            waypointInd = Random.Range(0, waypoints.Length);
        }

        Music = GameObject.Find("Music").GetComponent <AudioSource>();

        rolloffmode1 = AudioRolloffMode.Linear;
        //patrolSpeed = .5f;
        agent.updatePosition = true;
        agent.updateRotation = true;

        state = State.PATROL;

        alive = true;

        sound = gameObject.GetComponent <AudioSource>();



        sound.clip = chaseclip;
        //growlscript.StartCoroutine("GrowlsManager");
        StartCoroutine("FSM");
        multiplier = LevelProgression.MasterLevelMultiplier;
    }
示例#2
0
        void Start()
        {
            playa = GameObject.FindGameObjectWithTag("Player").transform;

            if (maxRayDistance == 0)
            {
                maxRayDistance = 25;
            }
            popupscript = GameObject.FindGameObjectWithTag("PopupManager").GetComponent <PopupManager>();
            animSpeed   = 1;


            agent = gameObject.GetComponentInParent <NavMeshAgent>();
            if (!agent)
            {
                agent = gameObject.transform.parent.root.GetComponent <NavMeshAgent>();
            }
            if (!agent)
            {
                agent = gameObject.transform.parent.root.GetComponentInChildren <NavMeshAgent>();
            }
            if (gameObject.CompareTag("FloatingEyebot"))
            {
                //bone = transform.root.gameObject;


                //eyebotGun = gameObject.transform.Find("floatingeyebot").transform.Find("Armature").transform.Find("Bone").transform.Find("Bone.001").transform.Find("Bone.002").transform.Find("Bone.002_end").transform.Find("Particle System").transform.gameObject;

                if (!eyebotGun)
                {
                    //bone = transform.root.gameObject;
                    eyebotGun = gameObject.transform.Find("Armature").transform.Find("Bone").transform.Find("Bone.001").transform.Find("Bone.002").transform.Find("Bone.002_end").transform.Find("Particle System").transform.gameObject;
                    Transform arm = transform.Find("Armature").gameObject.transform;
                    foreach (Transform child in arm)
                    {
                        if (child.gameObject.CompareTag("EyebotGun"))
                        {
                            eyebotGun = child.gameObject;
                        }
                    }

                    //Transform transform = gameObject.transform.root.transform.Find("Armature").transform;
                    // foreach (Transform child in transform)
                    //  {

                    //  }
                }
                eyebotGun.SetActive(false);
            }

            growlIndex = Random.Range(0, growls.Length);


            currentgrowl = growls[growlIndex];

            growlscript = GameObject.FindGameObjectWithTag("GrowlManager").GetComponent <GrowlManager>();

            levelMultiplier = LevelProgression.MasterLevelMultiplier;
            if (levelMultiplier == 0)
            {
                levelMultiplier = 1;
            }
            enemyStrength = Random.Range(1, 3) + levelMultiplier;
            polypRB       = gameObject.GetComponent <Rigidbody>();
            if (gameObject.CompareTag("Bbbot"))
            {
                particleHolder = gameObject.transform.Find("ParticleHolder").gameObject;
                particleHolder.SetActive(false);
            }
            if (gameObject.CompareTag("Robospider"))
            {
                particleHolder = gameObject.transform.Find("robospider2").transform.Find("Armature").transform.Find("Bone").transform.Find("ParticleHolder").gameObject;
                particleHolder.SetActive(false);
            }

            if (attackDistance == 0)
            {
                attackDistance = 4;
            }
            soundhashInd = Random.Range(0, growls.Length);
            if (gameObject.CompareTag("FloatingEyebot"))
            {
                anim = gameObject.GetComponentInParent <Animator>();
                polypRB.constraints = RigidbodyConstraints.FreezeAll;
                polypRB.constraints = RigidbodyConstraints.FreezePosition;
            }


            if (!gameObject.CompareTag("FloatingEyebot"))
            {
                anim = gameObject.GetComponent <Animator>();
                if (gameObject.CompareTag("GuardBot"))
                {
                    anim.enabled = false;
                    Debug.Log("Anim Disabled?");
                    polypRB.isKinematic = true;
                }
                if (gameObject.CompareTag("TwoWheel"))
                {
                    anim = gameObject.transform.Find("2wheelpart1").transform.gameObject.GetComponent <Animator>();
                }
            }

            character    = GetComponent <ThirdPersonCharacter>();
            clipPlaying  = false;
            chaseSpeed   = 1;
            m_playerdied = GameObject.Find("DeathManager").GetComponent <PlayerDied>();
            if (!randomize)
            {
                waypointInd = 0;
            }

            if (randomize)
            {
                waypoints   = GameObject.FindGameObjectsWithTag("Navpoints");
                waypointInd = Random.Range(0, waypoints.Length);
            }

            Music = GameObject.Find("Music").GetComponent <AudioSource>();

            rolloffmode1 = AudioRolloffMode.Linear;
            //patrolSpeed = .5f;
            agent.updatePosition = true;
            agent.updateRotation = true;

            state = BasicAI.State.PATROL;
            if (gameObject.CompareTag("GuardBot"))
            {
                state = BasicAI.State.GUARDBOT;
            }
            alive = true;

            sound = gameObject.GetComponent <AudioSource>();



            sound.clip = chaseclip;
            //growlscript.StartCoroutine("GrowlsManager");
            StartCoroutine("FSM");
            multiplier = LevelProgression.MasterLevelMultiplier;
            anim.SetFloat("speed", animSpeed);
        }