Пример #1
0
    void Start()
    {
        lunchTargets = new List <GameObject>();
        agent        = GetComponent <NavMeshAgent>();
        mStunCheck   = GetComponent <Stunable>();
        lunchTargets.Add(GameObject.Find("PlayerAvatar"));
        ZombieAI[] zombies = FindObjectsOfType(typeof(ZombieAI)) as ZombieAI[];
        foreach (ZombieAI zombie in zombies)
        {
            lunchTargets.Add(zombie.gameObject);
        }
        CompanionAI[] companions = FindObjectsOfType(typeof(CompanionAI)) as CompanionAI[];
        foreach (CompanionAI companion in companions)
        {
            if (!companion.vitalNPC)            //For making the Companion invulnerable
            {
                lunchTargets.Add(companion.gameObject);
            }
        }

        mAttacked     = false;
        mAudioManager = FindObjectOfType(typeof(AudioManager)) as AudioManager;
        if (mAudioManager)
        {
            mAudioManager.AddSoundEffect("Dino Growl", mGrowl);
        }

        moveTarget = lunchTargets[0].transform.position;
        mSleeping  = false;
    }
Пример #2
0
    // Use this for initialization
    void Start()
    {
        NumberofShields = 0;
        agent           = GetComponent <NavMeshAgent>();
        mStunCheck      = GetComponent <Stunable>();
        Object pointerArrow = Instantiate(Resources.Load("Prefabs/ClickToMoveTarget", typeof(GameObject)));

        pointerArrow.name    = "ClickToMoveIndicator";
        clickToMoveIndicator = GameObject.Find("ClickToMoveIndicator");
        mTimer = 0.0f;
        if (Application.platform == RuntimePlatform.IPhonePlayer)
        {
            //canTilt = true;
        }
        //Respawn with checkpoint put in start
        mInitialGasTimer   = mGasTimer;
        mGasBarLength      = mInitialGasTimer;
        mInitialShockTimer = mShockTimer;
        mShockBarLength    = mInitialShockTimer;
        anim = GetComponent <Animator>();
        anim.applyRootMotion = false;
        Sid = GameObject.Find("Sid_All_Anim");

        mAudioManager = FindObjectOfType(typeof(AudioManager)) as AudioManager;
        if (mAudioManager)
        {
            mAudioManager.AddSoundEffect("Cough", mCoughSoundEffect);
            mAudioManager.AddSoundEffect("Shock", mShockSoundEffect);
            mAudioManager.AddSoundEffect("Sid Hover", mSIDHoverEffect);
            mAudioManager.AddSoundEffect("Sid Die", mSIDDieEffect);
        }

        levelMap = FindObjectOfType(typeof(MapConsole)) as MapConsole;
    }
Пример #3
0
 // Start is called before the first frame update
 void Start()
 {
     if (StunComponent == null)
     {
         StunComponent = GetComponent <Stunable>();
     }
 }
Пример #4
0
 // Use this for initialization
 void Start()
 {
     lunchTargets  = new List <GameObject>();
     agent         = GetComponent <NavMeshAgent>();
     mStunCheck    = GetComponent <Stunable>();
     playerAvatar  = GameObject.Find("PlayerAvatar");
     mAttacked     = false;
     mAudioManager = FindObjectOfType(typeof(AudioManager)) as AudioManager;
     if (mAudioManager)
     {
         mAudioManager.AddSoundEffect("Zombie Growl", mGrowl);
     }
     lunchTargets.Add(GameObject.Find("PlayerAvatar"));
     CompanionAI[] companions = FindObjectsOfType(typeof(CompanionAI)) as CompanionAI[];
     foreach (CompanionAI companion in companions)
     {
         if (!companion.vitalNPC)            //For making the Companion invulnerable
         {
             lunchTargets.Add(companion.gameObject);
         }
     }
     anim = GetComponent <Animator>();
     anim.applyRootMotion = false;
     playerMovement       = lunchTargets[0].GetComponent <PlayerMovement>();
 }
Пример #5
0
 void Start()
 {
     stun            = new Stunable();
     rigidbody2d     = transform.parent.GetComponentInParent <Rigidbody2D>();
     knockable       = new Knockable(rigidbody2d);
     canMove         = false;
     enemy           = transform.parent.parent;
     target          = GameObject.FindWithTag("Player").transform; //target the player
     range           = GetComponent <CircleCollider2D>();
     range.isTrigger = true;
 }
Пример #6
0
 // Use this for initialization
 void Start()
 {
     player     = GetComponent <Player>();
     moveSpeedX = 1.75f;
     moveSpeedY = 1.3f;
     stun       = new Stunable();
     rbody      = GetComponent <Rigidbody2D>();
     knockable  = new Knockable(rbody);
     anim       = GetComponent <Animator>();
     anim.SetFloat("input_x", 1);
     knockable.Multiplier = moveSpeedX;
     IsRunning            = false;
     StartCoroutine(RunningLoseMana());
     //spriteRenderer = GetComponent<SpriteRenderer>();
 }
Пример #7
0
 //If the stunable entity is stays here while its active, zap them
 void OnTriggerEnter(Collider other)
 {
     if (bActive)
     {
         if (other.gameObject.GetComponent <PlayerMovement>())
         {
             other.gameObject.GetComponent <PlayerMovement>().mNumShocks++;
         }
         Stunable stunOther = other.gameObject.GetComponent <Stunable>();
         if (stunOther != null)
         {
             stunOther.Stun();
             stunOther.mTypeofStun = Stunable.StunType.ShockStun;
         }
     }
 }
Пример #8
0
    void OnTriggerStay(Collider other)
    {
        PlayerMovement player = other.GetComponent <PlayerMovement>();

        if (bActive)
        {
            Stunable stunOther = other.gameObject.GetComponent <Stunable>();
            if (stunOther != null)
            {
                stunOther.Stun();
                stunOther.mTypeofStun = Stunable.StunType.ShockStun;
            }

            if (player != null)
            {
                if (player.mNumShocks <= 1)
                {
                    if (!mAffectedPlayer)
                    {
                        player.mShockStartTime = Time.time;
                        player.mInShock        = true;
                        player.GetComponent <Stunable>().mTypeofStun = Stunable.StunType.ShockStun;
                        player.mShockBarLength = other.GetComponent <PlayerMovement>().mShockTimer * 10;

                        mAffectedPlayer = true;
                    }
                }
                else
                {
                    mAffectedPlayer = true;
                }
            }
        }
        else
        {
            if (player != null)
            {
                player.mInShock = false;
                mAffectedPlayer = false;
                player.GetComponent <Stunable>().mTypeofStun = Stunable.StunType.NotStunned;
            }
        }
        player = null;
    }
Пример #9
0
 // Start is called before the first frame update
 void Start()
 {
     if (playerObj == null)
     {
         playerObj = GameObject.FindGameObjectWithTag("Player");
     }
     if (stunComponent == null)
     {
         stunComponent = GetComponent <Stunable>();
     }
     if (agent == null)
     {
         agent = GetComponent <NavMeshAgent>();
     }
     if (emiter == null)
     {
         emiter = GetComponent <ParticleSystem>();
     }
 }
Пример #10
0
 //Trigger by the dinos and the zombies when the player dies
 public void PlayerDeath(GameObject killer, string killerID)
 {
     //Check to see if the player has a shield already
     if (NumberofShields > 0 && (killerID != "Killed by Gas" && killerID != "Killed by Shock"))
     {
         Stunable stunOther = killer.gameObject.GetComponent <Stunable>();
         if (stunOther != null)
         {
             stunOther.Stun();
             Sid.transform.position = killer.transform.position;
             Sid.GetComponent <Animator>().Play("Death");
             Sid.transform.position = killer.transform.position;
         }
         Sid.transform.position = killer.transform.position;
         StartCoroutine(WaitForAnim(killer));
     }
     else
     {
         //Assets.CustomeScripts.Metrics.AddMetric("Killer ID was:", killerID);
         FindObjectOfType <CameraFade>().sceneEnding = true;
     }
 }    // end player death