Exemplo n.º 1
0
 public void Drop()
 {
     hasBeenThrown    = true;
     transform.parent = null;
     rb.isKinematic   = false;
     SetTransparency(1f);
     gameObject.layer = initialLayer;
     throwHitboxCollider.isTrigger = true;
     throwHitboxCollider.enabled   = true;
     AUD_Manager.SetSwitch("ObjectSize", properties.objSize, gameObject);
     AUD_Manager.PostEvent("PC_ThrowWhooshes_ST_PL", gameObject);
 }
Exemplo n.º 2
0
    public void OnCheckpointRestart()
    {
        AUD_Manager.PostEvent("MS_GAMEPLAY_LP_SP", gameObject);
        switch (mInd)
        {
        case 0: AUD_Manager.EventFromData(mFirstStage, gameObject); break;

        case 1: AUD_Manager.EventFromData(mSecondStage, gameObject); break;

        case 2: AUD_Manager.EventFromData(mThirdStage, gameObject); break;

        case 3: AUD_Manager.EventFromData(mFourthStage, gameObject); break;
        }
    }
Exemplo n.º 3
0
 public void AddScore(object data)
 {
     if (specialPowerStatus.Value < 1f && playerState.isUsingSpecialPower == false)
     {
         float scoreToAdd = (float)data;
         specialPowerStatus.Value += scoreToAdd.Normalize(0f, specialPowerScoreTarget);
         if (specialPowerStatus.Value >= 1f)
         {
             specialPowerStatus.Value = 1f;
             onSlowMotionPowerAvailable.Raise(null);
             AUD_Manager.PostEvent("PH_UI_Up_ST", gameObject);
         }
     }
 }
Exemplo n.º 4
0
 private void Update()
 {
     if (mActive)
     {
         for (int i = 0; i < mThrowSpawnPoints.Length; i++)
         {
             if (objInstances[i] == null)
             {
                 objInstances[i] = Instantiate(objPrefab, mThrowSpawnPoints[i].transform.position, mThrowSpawnPoints[i].transform.rotation);
                 AUD_Manager.PostEvent("AM_GravLiftTeleport_ST", objInstances[i].gameObject);
                 // AUD_Manager.PostEvent("PC_Tutorial_ObjectSpawn", objInstances[i].gameObject);
                 Instantiate(spawnParticles, mThrowSpawnPoints[i].transform.position, mThrowSpawnPoints[i].transform.rotation);
             }
         }
     }
 }
Exemplo n.º 5
0
 public void TakeDamage(float damage)
 {
     health -= damage;
     if (health <= 0)
     {
         StartCoroutine(DestroySelf());
         AUD_Manager.PostEvent("EN_LankyShieldBreak_ST", gameObject);
     }
     else
     {
         if (particles != null)
         {
             Destroy(particles.gameObject);
         }
         AUD_Manager.PostEvent("EN_LankyShieldHit_ST", gameObject);
     }
 }
Exemplo n.º 6
0
    private void StartThrowingGrenade()
    {
        animationController.PlayChargeGrenadeAnimation();
        isChargingThrow.Value = playerState.throwingGrenade = true;
        canThrowGrenade.Value = false;
        AUD_Manager.PostEvent("PC_OilPre_ST_PL", gameObject);

        grenadeInstance = Instantiate(grenadePrefab);
        grenadeInstance.transform.SetParent(gameObject.transform);
        grenadeInstance.transform.localPosition = Vector3.zero;
        grenadeInstance.transform.localRotation = Quaternion.Euler(Vector3.zero);

        transform.Rotate(-grenadeLauncherProperties.throwingAngle, 0f, 0f);
        throwingForce.Value = grenadeLauncherProperties.minThrowingForce;
        grenadeInstance.GetComponent <TanningOilGrenade>().throwingForce = grenadeLauncherProperties.minThrowingForce;
        onPlayerAim.Raise(true);
    }
Exemplo n.º 7
0
    private void Fire()
    {
        mFireTimeStamp = Time.time;

        Vector3 dir = Vector3.Normalize(mVictim.position - transform.position);

        GameObject clone = Instantiate(mTurretGunProperties.mBullet, mFirePoint.position, Quaternion.LookRotation(dir, Vector3.up));

        clone.GetComponent <Bullet>().SetOwner(transform.parent);
        clone.GetComponent <Bullet>().SetTarget(mVictim);

        Instantiate(mGunProperties.mMuzzleBlast, mFirePoint.transform.position, transform.rotation);

        AUD_Manager.PostEvent(mGunProperties.mAudFireEvent, gameObject);

        mCurChargeAmt = 0f;
    }
Exemplo n.º 8
0
    // Called by the run animation at the correct frame.
    private void RunStep()
    {
        // Now we actually have to raycast downwards and check what type of terrain we're on.
        TerrainType type = FindTerrainStandingOn();

        switch (type)
        {
        case TerrainType.GRASS: AUD_Manager.SetSwitch("Surface_Type", "Grass", gameObject); break;

        case TerrainType.SAND: AUD_Manager.SetSwitch("Surface_Type", "Sand", gameObject); break;

        case TerrainType.CONCRETE: AUD_Manager.SetSwitch("Surface_Type", "Concrete", gameObject); break;

        case TerrainType.ERROR: break;
        }

        AUD_Manager.PostEvent(mRunStepEventName, gameObject);
    }
Exemplo n.º 9
0
 public void PickUp(Transform parentTransform)
 {
     foreach (Collider coll in collidersBeforePickup)
     {
         coll.isTrigger = true;
         coll.enabled   = false;
     }
     transform.parent        = parentTransform;
     transform.localRotation = Quaternion.Euler(rotationWhenPickedUp);
     initialLayer            = gameObject.layer;
     pickedUp         = true;
     gameObject.layer = layerWhenPickedUp;
     if (properties.transparencyWhenPickedup != 0.0)
     {
         SetTransparency(properties.transparencyWhenPickedup);
     }
     AUD_Manager.SetSwitch("ObjectAction", "Pickup", gameObject);
     AUD_Manager.PostEvent(properties.soundEventName, gameObject);
 }
Exemplo n.º 10
0
    private void Fire()
    {
        mFireTimeStamp = Time.time;

        Vector3 dir = Vector3.Normalize(mVictim.position - transform.position);

        GameObject clone;
        bool       red = (Random.value < 0.5);

        if (red)
        {
            clone = Instantiate(mCannonProperties.mRedBullet, mFirePoint.position, Quaternion.LookRotation(dir, Vector3.up));
        }
        else
        {
            clone = Instantiate(mCannonProperties.mBlueBullet, mFirePoint.position, Quaternion.LookRotation(dir, Vector3.up));
        }

        clone.GetComponent <Bullet>().SetOwner(mEntity.transform);
        clone.GetComponent <Bullet>().SetTarget(mVictim);

        Instantiate(mGunProperties.mMuzzleBlast, mFirePoint.transform.position, transform.rotation);

        AUD_Manager.PostEvent(mGunProperties.mAudFireEvent, gameObject);
        AUD_Manager.DynamicDialogueFromData(mEntity.GetBase().mShootLine, gameObject);

        mEntity.GetBase().mEnemyFired.Raise(null);

        // Tank cannon specific stuff.
        mNumFiredThisVolley++;
        if (mNumFiredThisVolley == mCannonProperties.mNumInVolley)
        {
            mState              = CANNON_STATE.CHARGING;
            mCurChargeAmt       = 0f;
            mNumFiredThisVolley = 0;
        }
        else
        {
            mState         = CANNON_STATE.PREFIRE;
            mCurChamberAmt = 0f;
        }
    }
Exemplo n.º 11
0
    /************************************************************************************************
    *  Each individual weapon will define how it fires its projectile.
    *  By the time this has been called we are sure that we are firing the weapon. We have already checked
    *  that we are loaded, charged, and nothing else is preventing us from firing.
    *
    *  Great opportunity to use Carlos's Event system.
    ************************************************************************************************/
    protected virtual void FireProjectile(Transform trans)
    {
        mFireTimeStamp = Time.time;

        // our plasma ray gun is as basic as it gets, spawning a plasmoid and then trying to re-chamber.
        // The target has already been set, and the projectile now simply has to have force added in the direction
        Vector3 dir = Vector3.Normalize(trans.position - transform.position);

        // GameObject clone = PhotonNetwork.Instantiate(mGunProperties.bullet.name, transform.position, Quaternion.LookRotation(dir, Vector3.up));
        dir = CalculateRandomError(dir);
        GameObject    clone = Instantiate(mRegGunProperties.bullet, firePoint.position, Quaternion.LookRotation(dir, Vector3.up));
        AI_Controller owner = UT_FindComponent.FindComponent <AI_Controller>(gameObject);

        if (owner != null)
        {
            clone.GetComponent <Bullet>().SetOwner(owner.transform);
        }
        else
        {
            clone.GetComponent <Bullet>().SetOwner(transform);
        }
        clone.GetComponent <Bullet>().SetTarget(trans);

        // Also, got to create those particles for the muzzle blast
        if (mGunProperties.mMuzzleBlast)
        {
            var mBlast = Instantiate(mGunProperties.mMuzzleBlast, firePoint.transform.position, transform.rotation);
        }

        for (int i = 0; i < mGunProperties.mSwitchGroups.Length; i++)
        {
            AUD_Manager.SetSwitch(mGunProperties.mSwitchGroups[i], mGunProperties.mSwitchStates[i], gameObject);
        }
        AUD_Manager.PostEvent(mGunProperties.mAudFireEvent, gameObject);

        // play the dialogue for our character shooting.
        AUD_Manager.DynamicDialogueFromData(owner.GetBase().mShootLine, gameObject);

        // Now push the event that a weapon has fired.
        owner.GetBase().mEnemyFired.Raise(null);
    }
Exemplo n.º 12
0
    private void Update()
    {
        if (isGamePaused == false && Time.unscaledTime >= lastSlowMotionEffectStartTimestamp + timeBeforeStartRecovering)
        {
            Time.timeScale     += (1f / slowDownRecoveryTime) * Time.unscaledDeltaTime; // Not affected
            Time.fixedDeltaTime = Time.timeScale * 0.02f;                               // Because fixed update runs at 50fps
            Time.timeScale      = Mathf.Clamp(Time.timeScale, 0f, 1f);

            if (Time.timeScale == 1f && cachedTimeScale != Time.timeScale)
            {
                AUD_Manager.PostEvent("FX_Slomo_LP_SP", gameObject);
                if (triggeredBySpecialMove)
                {
                    onSlowMotionEffectEnded.Raise(null);
                    triggeredBySpecialMove = false;
                }
            }

            cachedTimeScale = Time.timeScale;
        }
    }
Exemplo n.º 13
0
    private void Awake()
    {
        rb = GetComponent <Rigidbody>();

        damage = properties.defaultDamage;
        speed  = properties.defaultSpeed;
        if (Difficulty.Value == "EASY")
        {
            damage *= properties.easyDamageMult;
            speed  *= properties.easySpeedMult;
        }
        if (Difficulty.Value == "NORMAL")
        {
            damage *= properties.normalDamageMult;
            speed  *= properties.normalSpeedMult;
        }

        SetVelocity();
        bulletTracker.bullets.Add(this);
        isHoming = properties.startHomingInmediatly;
        AUD_Manager.PostEvent(properties.ad_loop, gameObject);
    }
Exemplo n.º 14
0
 public void OnPoseStarted(object data)
 {
     AUD_Manager.PlayerDialogue(mPoseDialogue, gameObject, Player.Value);
     AUD_Manager.PostEvent(mEvent, gameObject);
 }
Exemplo n.º 15
0
 protected override void UIScreenDisabled()
 {
     AUD_Manager.PostEvent("FE_UI_Back_ST", gameObject);
 }
Exemplo n.º 16
0
 public void OnSelect(BaseEventData eventData)
 {
     AUD_Manager.PostEvent("FE_UI_Down_ST", gameObject);
 }
Exemplo n.º 17
0
 public void PlayMeleeSounds()
 {
     AUD_Manager.PlayerDialogue(mAttack, gameObject, Player.Value);
     AUD_Manager.PostEvent("PC_MeleeWhoosh_ST_PL", gameObject);
 }
Exemplo n.º 18
0
 public void OnScreenTransitioned()
 {
     AUD_Manager.PostEvent("FE_Transitions_ST", gameObject);
 }
Exemplo n.º 19
0
 public void HandleSlideReplenish()
 {
     AUD_Manager.PostEvent("IG_UI_Slide_ST", gameObject);
 }
Exemplo n.º 20
0
 protected override void UIScreenEnabled()
 {
     StartCoroutine(SetPreselectedObject());
     AUD_Manager.PostEvent("IG_UI_MenuOpen_ST", gameObject);
     AUD_Manager.SetState("PauseMenu", "PauseGame");
 }
Exemplo n.º 21
0
 public void HandleLand()
 {
     AUD_Manager.PostEvent("PC_JumpStart_ST", gameObject);
     AUD_Manager.PlayerDialogue(mJumpLand, gameObject, Player.Value);
 }
Exemplo n.º 22
0
 public void OnButtonPress()
 {
     AUD_Manager.PostEvent("FE_UI_Enter_ST", gameObject);
 }
Exemplo n.º 23
0
 private void OnDestroy()
 {
     AUD_Manager.PostEvent("AM_GravLift_LP_SP", gameObject);
 }
Exemplo n.º 24
0
 private void Awake()
 {
     Instantiate(explosionParticles, transform.position, Quaternion.identity);
     AUD_Manager.PostEvent("PC_OilSplash_ST_PL", gameObject);
     Destroy(gameObject, 0.2f);
 }
Exemplo n.º 25
0
 public void OnBackScreen()
 {
     AUD_Manager.PostEvent("FE_UI_Back_ST", gameObject);
 }
Exemplo n.º 26
0
 public void EnemySpawnLiftSound()
 {
     AUD_Manager.PostEvent(eName, gameObject);
 }
Exemplo n.º 27
0
 private void OnDestroy()
 {
     AUD_Manager.PostEvent("PC_SlideStop_ST", gameObject);
 }
Exemplo n.º 28
0
 public void OnScrollDown()
 {
     AUD_Manager.PostEvent("FE_UI_Up_ST", gameObject);
 }
Exemplo n.º 29
0
 // Use this for initialization
 void Start()
 {
     AUD_Manager.PostEvent("AM_GravLift_LP_PL", gameObject);
 }
Exemplo n.º 30
0
 protected override void UIScreenEnabled()
 {
     AUD_Manager.PostEvent("FE_UI_Enter_ST", gameObject);
 }