Example #1
0
        private void BoostShake()
        {
            if (isMoving && m_PowerupDistance > 0)
            {
                if (m_BoostShakeId < 0)
                {
                    // Screen shake go!
                    if (ScreenShakeController.s_InstanceExists)
                    {
                        ScreenShakeController shaker = ScreenShakeController.s_Instance;

                        // Scale magnitude
                        m_BoostShakeId = shaker.DoPerpetualShake(Vector2.right, m_NitroShakeMagnitude);
                    }
                }
            }
            else if (m_BoostShakeId >= 0)
            {
                if (ScreenShakeController.s_InstanceExists)
                {
                    ScreenShakeController shaker = ScreenShakeController.s_Instance;

                    shaker.StopShake(m_BoostShakeId);
                    m_BoostShakeId = -1;
                }
            }
        }
Example #2
0
    private void DoShakeForExplosion(Vector3 explosionPosition, ExplosionSettings explosionConfig)
    {
        // Do screen shake on main camera
        if (ScreenShakeController.s_InstanceExists)
        {
            ScreenShakeController shaker = ScreenShakeController.s_Instance;

            float shakeMagnitude = explosionConfig.shakeMagnitude;
            shaker.DoShake(explosionPosition, shakeMagnitude, m_ExplosionScreenShakeDuration, 0.0f, 1.0f);
        }
    }
Example #3
0
        private void ExplodeBuilding()
        {
            isAlive = false;
            RpcExplodeBuilding();

            // Скриншейк
            if (ScreenShakeController.s_InstanceExists)
            {
                ScreenShakeController shaker = ScreenShakeController.s_Instance;

                shaker.DoShake(transform.position, magnitude, duration);
            }
        }
Example #4
0
 //Start Method
 private void Start()
 {
     cursorChangerController = this.GetComponent <CursorChangerController>();
     spellEffectController   = this.GetComponent <SpellEffectController>();
     manaController          = this.GetComponent <ManaController>();
     screenShakeController   = this.GetComponent <ScreenShakeController>();
     devourerController      = this.GetComponent <DevourerController>();
     screenFlashController   = this.GetComponent <ScreenFlashController>();
     corruptionController    = this.GetComponent <CorruptionController>();
     environmentController   = this.GetComponent <EnvironmentController>();
     conditionController     = this.GetComponent <ConditionController>();
     grimmoireController     = this.GetComponent <GrimmoireController>();
     enemySpawner            = this.GetComponent <EnemySpawner>();
     soundController         = this.GetComponent <SoundController>();
 }
Example #5
0
    private void Fire()
    {
        // Set the fired flag so only Fire is only called once.
        m_Fired = true;

        //Determine which shell we should fire.
        Shell shellToFire = GetShellType().GetComponent <Shell>();

        //Determine our firing solution based on our target location and power.

        Vector3 fireVector = CalculateFireVector(shellToFire, m_TargetFirePosition, m_FireTransform.position, m_CurrentLaunchForce, m_LaunchAngle);
        //Vector3 direction = m_TargetFirePosition - m_FireTransform.position;
        //Vector3 fireVector = m_CurrentLaunchForce * direction / direction.magnitude;

        // Get a random seed to associate with projectile on all clients.
        // This is specifically used for the cluster bomb and any debris spawns, to ensure that their
        // random velocities are identical
        int randSeed = UnityEngine.Random.Range(int.MinValue, int.MaxValue);

        // Immediately fire shell on client - this provides players with the necessary feedback they want
        FireVisualClientShell(fireVector, m_FireTransform.position, randSeed);
        myAcademy.AddRewardToPlayer(m_PlayerNumber, 1f);

        // Reset the launch force.  This is a precaution in case of missing button events.
        //m_CurrentLaunchAngle = m_MaxLaunchAngle;
        m_CurrentLaunchForce = m_MinLaunchForce;

        m_ReloadTime = m_RefireRate;

        // Small screenshake on client
        if (ScreenShakeController.s_InstanceExists)
        {
            ScreenShakeController shaker = ScreenShakeController.s_Instance;

            //float chargeAmount = Mathf.InverseLerp(m_MaxLaunchAngle, m_MinLaunchAngle, m_CurrentLaunchAngle);
            float chargeAmount = Mathf.InverseLerp(m_MaxLaunchForce, m_MinLaunchForce, m_CurrentLaunchForce);
            float magnitude    = Mathf.Lerp(m_ShootShakeMinMagnitude, m_ShootShakeMaxMagnitude, chargeAmount);
            // Scale magnitude
            shaker.DoShake(m_TargetFirePosition, magnitude, m_ShootShakeDuration);
        }

        m_RecoilTime = 1;
        Vector3 localVector = transform.InverseTransformVector(fireVector);

        m_RecoilDirection = new Vector2(-localVector.x, -localVector.z);
    }
 //
 void Start()
 {
     cam       = Camera.main.transform;
     camOrigin = Camera.main.transform.position;
     instance  = this;
 }
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
 }
 // Start is called before the first frame update
 void Start()
 {
     instance = this;
     shaking  = false;
 }
Example #9
0
 private void Start()
 {
     instance = this;
 }