예제 #1
0
 //after the gas leaves, Dinos resume can be unstun and will begin functioning normal again
 //after the gas leaves, the Player's gas timers are reset, and gas masks removed if any
 void OnTriggerExit(Collider other)
 {
     if (other.GetComponent <DinoAI>())
     {
         DinoAI dino = other.GetComponent <DinoAI>();
         dino.GetComponent <Stunable>().bStayStunned = false;
         dino.GetComponent <Stunable>().IsStunned    = false;
         other.GetComponent <DinoAI>().GetComponent <Stunable>().mTypeofStun = Stunable.StunType.NotStunned;
     }
     else if (other.GetComponent <PlayerMovement>())
     {
         PlayerMovement player = other.GetComponent <PlayerMovement>();
         player.GetComponent <Stunable>().mTypeofStun = Stunable.StunType.NotStunned;
         if (player != null)
         {
             player.mNumGases--;
             if (player.mNumGases <= 0)
             {
                 player.mInGas   = false;
                 mAffectedPlayer = false;
             }
             //if (player.mHasGasMask)
             //{
             //    player.mGasTimer = player.mInitialGasTimer;
             //    player.mHasGasMask = false;
             //}
         }
     }
 }
예제 #2
0
    //while colliding with the gas, Dinos and the Player will be affected by it
    void OnTriggerStay(Collider other)
    {
        if (mGasActive)
        {
            //if a Dino is colliding with the gas, it is stunned and will stay stunned as long as it touches the gas
            if (other.GetComponent <DinoAI>())
            {
                other.GetComponent <DinoAI>().GetComponent <Stunable>().bStayStunned = true;
                other.GetComponent <DinoAI>().GetComponent <Stunable>().IsStunned    = true;
                other.GetComponent <DinoAI>().GetComponent <Stunable>().mTypeofStun  = Stunable.StunType.GasStun;
                other.GetComponent <DinoAI>().GetComponent <Animator>().SetBool("SleepBool", true);
                other.GetComponent <DinoAI>().GetComponent <Animator>().SetBool("ShockBool", false);
            }
            else if (other.GetComponent <PlayerMovement>())
            {
                if (other.GetComponent <PlayerMovement>().mNumGases <= 1)
                {
                    if (!mAffectedPlayer)
                    {
                        other.GetComponent <PlayerMovement>().GetComponent <Stunable>().mTypeofStun = Stunable.StunType.GasStun;
                        if (!other.GetComponent <PlayerMovement>().mHasGasMask || (other.GetComponent <PlayerMovement>().mHasGasMask&& !mGasMaskAffected))
                        {
                            other.GetComponent <PlayerMovement>().mGasStartTime = Time.time;
                        }

                        other.GetComponent <PlayerMovement>().mInGas = true;
                        if (other.GetComponent <PlayerMovement>().mHasGasMask)
                        {
                            other.GetComponent <PlayerMovement>().mGasBarLength = other.GetComponent <PlayerMovement>().mGasTimer * 10;
                            mGasMaskAffected = true;
                            if (other.GetComponent <PlayerMovement>().mGasesVisited.Contains(this))
                            {
                                other.GetComponent <PlayerMovement>().mGasesVisited.Add(this);
                            }
                        }
                        else
                        {
                            other.GetComponent <PlayerMovement>().mGasBarLength = other.GetComponent <PlayerMovement>().mGasMaskTimer * 10;
                        }
                        mAffectedPlayer = true;
                    }
                }
                else
                {
                    mAffectedPlayer = true;
                }
            }
        }
        else
        {
            if (other.GetComponent <DinoAI>())
            {
                DinoAI dino = other.GetComponent <DinoAI>();
                dino.GetComponent <Stunable>().bStayStunned = false;
                dino.GetComponent <Stunable>().IsStunned    = false;
                other.GetComponent <DinoAI>().GetComponent <Animator>().SetBool("SleepBool", false);
            }
            else if (other.GetComponent <PlayerMovement>())
            {
                PlayerMovement player = other.GetComponent <PlayerMovement>();
                if (player != null)
                {
                    player.mInGas   = false;
                    mAffectedPlayer = false;
                }
            }
        }
    }