コード例 #1
0
 void OnRecycle()
 {
     _CurrentHits = 0;
     _stuckOn     = null;
     _hasStuck    = false;
     PlayOnStuck?.Stop();
     PlayOnStuck?.Clear();
     ShowOnStuck?.SetActive(false);
 }
コード例 #2
0
 public void Deactive()
 {
     _powerIndicator.Stop();
     _powerIndicator.Clear();
 }
コード例 #3
0
			private void LateUpdate()
			{
				if (_path != null)
				{
					if (stage == 0)
					{
						stage++;
					}
					else if (stage == 1)
					{
						EnableRenderers(true);
						int index = 0;
						while (true)
						{
							if (index >= bones.Length)
							{
								stage++;
								break;
							}
							if (index == 0)
							{
								transform.position = _path.CalculateBezierPoint(0, animCurve.Evaluate(time));
								transform.LookAt(_path.CalculateBezierPoint(0, animCurve.Evaluate(time + 0.01f)));
							}
							bones[index].transform.position = _path.CalculateBezierPoint(0, animCurve.Evaluate(time - (index * boneDistance)));
							index++;
						}
					}
					else if (stage == 2)
					{
						stage++;
					}
					else if (stage != 3)
					{
						if (stage == 4)
						{
							Creature creature;
							EnableRenderers(false);
							impact.transform.position = _targetPosition;
							impact.transform.LookAt(impact.transform.position + transform.forward);
							impact.Play(true);
							if (_castingCreature.TryGetCreatureFromTarget(EndTarget, out creature))
							{
								creature.AttackTargetCreature(impact.transform.forward);
							}
							if (SimpleSingletonBehaviour<CameraController>.HasInstance)
							{
								TS_CameraShaker.CallPushInDirection(0.1f, impact.transform.forward);
							}
							stage++;
						}
					}
					else
					{
						int index = 0;
						while (true)
						{
							if (index >= bones.Length)
							{
								time += Time.deltaTime;
								if (time > 1f)
								{
									stage++;
								}
								if (!drizzle.isEmitting)
								{
									drizzle.Clear(true);
									drizzle.Play(true);
								}
								break;
							}
							if (index == 0)
							{
								transform.position = _path.CalculateBezierPoint(0, animCurve.Evaluate(time));
								transform.LookAt(_path.CalculateBezierPoint(0, animCurve.Evaluate(time + 0.01f)));
							}
							bones[index].transform.position = _path.CalculateBezierPoint(0, animCurve.Evaluate(time - (index * boneDistance)));
							index++;
						}
					}
					TryPlayImpactAudio(time);
				}
			}
コード例 #4
0
 public void RemoveBomb()
 {
     hasBomb = false;
     fire.Pause();
     fire.Clear();
 }
コード例 #5
0
 // Start is called before the first frame update
 void Start()
 {
     ps = GetComponent <ParticleSystem>();
     ps.Pause(true);
     ps.Clear(true);
 }
コード例 #6
0
        /// <summary>
        /// Performs the cast.
        /// </summary>
        /// <param name="origin">The location that the cast should spawn from.</param>
        /// <param name="direction">The direction of the cast.</param>
        /// <param name="targetPosition">The target position of the cast.</param>
        public override void Cast(Transform origin, Vector3 direction, Vector3 targetPosition)
        {
#if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER
            if (m_MagicItem.NetworkInfo != null && m_MagicItem.NetworkInfo.IsLocalPlayer())
            {
                m_MagicItem.NetworkCharacter.MagicCast(m_MagicItem, m_Index, m_CastID, direction, targetPosition);
            }
#endif

            var position = MathUtility.TransformPoint(origin.position, m_Transform.rotation, m_PositionOffset);
            if (targetPosition != position)
            {
                direction = (targetPosition - position).normalized;
            }
            if (m_ProjectDirectionOnPlane)
            {
                direction = Vector3.ProjectOnPlane(direction, m_CharacterLocomotion.Up);
            }
            // The direction can't be 0.
            if (direction.sqrMagnitude == 0)
            {
                direction = m_CharacterLocomotion.transform.forward;
            }
            var rotation = Quaternion.LookRotation(direction, m_CharacterLocomotion.Up) * Quaternion.Euler(m_RotationOffset);

            // If the cast is currently active then the particle should be reused.
            if (m_Active)
            {
                if (m_SetRendererLengthScale)
                {
                    SetRendererLength(origin.position, targetPosition);
                }
                if (!m_ParentToOrigin)
                {
                    m_ParticleTransform.position = position;
                }
                m_ParticleTransform.rotation = rotation;
                return;
            }

            if (m_ParticlePrefab == null)
            {
                Debug.LogError("Error: A Particle Prefab must be specified.", m_MagicItem);
                return;
            }

#if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER
            // The local player will spawn the particle if the object is a networked magic object.
            if (m_MagicItem.NetworkInfo != null && !m_MagicItem.NetworkInfo.IsLocalPlayer())
            {
                if (m_ParticlePrefab.GetComponent <INetworkMagicObject>() != null)
                {
                    return;
                }
            }
#endif

            if (m_FadeEvent != null)
            {
                Scheduler.Cancel(m_FadeEvent);
                m_FadeEvent = null;
                SetRendererAlpha(0);
            }
            var obj = ObjectPool.Instantiate(m_ParticlePrefab, position, rotation, m_ParentToOrigin ? origin : null);
            m_ParticleTransform = obj.transform;
            m_ParticleTransform.SetLayerRecursively(m_ParticleLayer);
            m_ParticleSystem = obj.GetCachedComponent <ParticleSystem>();

            if (m_ParticleSystem == null)
            {
                Debug.LogError($"Error: A Particle System must be specified on the particle {m_ParticlePrefab}.", m_MagicItem);
                return;
            }

            m_ParticleSystem.Clear(true);
            m_Renderers = null;
            if (m_SetRendererLengthScale)
            {
                SetRendererLength(origin.position, targetPosition);
            }
            StartMaterialFade(obj);

            // The MagicParticle can determine the impacts.
            var magicParticle = obj.GetComponent <MagicParticle>();
            if (magicParticle != null)
            {
                magicParticle.Initialize(m_MagicItem, m_CastID);
            }
            m_Active = true;

#if ULTIMATE_CHARACTER_CONTROLLER_MULTIPLAYER
            if (m_MagicItem.NetworkInfo != null && m_MagicItem.NetworkInfo.IsLocalPlayer())
            {
                var networkMagicObject = obj.GetComponent <INetworkMagicObject>();
                if (networkMagicObject != null)
                {
                    networkMagicObject.Instantiate(m_GameObject, m_MagicItem, m_Index, m_CastID);
                }

                NetworkObjectPool.NetworkSpawn(m_ParticlePrefab, obj, false);
            }
#endif
        }
コード例 #7
0
 public void reset()
 {
     ultimateBase.Clear();
     ultimateBeam.Clear();
 }
コード例 #8
0
 private static void ClearParticle(ParticleSystem ps)
 {
     ps.Stop();
     ps.Clear();
 }
コード例 #9
0
 void DustPause()
 {
     dust.Pause();
     dust.Clear();
 }
コード例 #10
0
 /// <summary>
 /// Delete all particles from the system.
 /// </summary>
 public void ClearParts()
 {
     PartSys.Clear();
     VolumeChangeWaitTime = 0f;
 }
コード例 #11
0
 // Helper functions
 private void ClearParticleEffects()
 {
     _activeParticle.Stop(true);
     _activeParticle.Clear(true);
 }
コード例 #12
0
 public static void ResetEffect(GameObject oEffect)
 {
     if (oEffect == null)
     {
         return;
     }
     if (oEffect.layer == SpawnPool.miEffectLayer || oEffect.layer == SpawnPool.miUIEffectLayer || oEffect.layer == SpawnPool.miModelLayer)
     {
         NcDuplicator componentInChildren = oEffect.GetComponentInChildren <NcDuplicator>();
         if (componentInChildren != null)
         {
             LogSystem.LogWarning(new object[]
             {
                 oEffect.name,
                 " NcDuplicator cannot be replayed."
             });
             return;
         }
         NcSpriteAnimation[] componentsInChildren = oEffect.GetComponentsInChildren <NcSpriteAnimation>(true);
         for (int i = 0; i < componentsInChildren.Length; i++)
         {
             if (componentsInChildren[i] != null)
             {
                 componentsInChildren[i].ResetAnimation();
             }
         }
         NcCurveAnimation[] componentsInChildren2 = oEffect.GetComponentsInChildren <NcCurveAnimation>(true);
         for (int j = 0; j < componentsInChildren2.Length; j++)
         {
             if (componentsInChildren2[j] != null)
             {
                 componentsInChildren2[j].ResetAnimation();
             }
         }
         NcDelayActive[] componentsInChildren3 = oEffect.GetComponentsInChildren <NcDelayActive>(true);
         for (int k = 0; k < componentsInChildren3.Length; k++)
         {
             if (componentsInChildren3[k] != null)
             {
                 componentsInChildren3[k].ResetAnimation();
             }
         }
         NcUvAnimation[] componentsInChildren4 = oEffect.GetComponentsInChildren <NcUvAnimation>(true);
         for (int l = 0; l < componentsInChildren4.Length; l++)
         {
             if (componentsInChildren4[l] != null)
             {
                 componentsInChildren4[l].ResetAnimation();
             }
         }
         ParticleSystem[] componentsInChildren5 = oEffect.GetComponentsInChildren <ParticleSystem>(true);
         for (int m = 0; m < componentsInChildren5.Length; m++)
         {
             ParticleSystem particleSystem = componentsInChildren5[m];
             if (particleSystem != null)
             {
                 particleSystem.Stop();
                 particleSystem.Clear();
                 particleSystem.time = 0f;
                 particleSystem.Play();
             }
         }
         Animation[] componentsInChildren6 = oEffect.GetComponentsInChildren <Animation>(true);
         for (int n = 0; n < componentsInChildren6.Length; n++)
         {
             Animation animation = componentsInChildren6[n];
             if (!(animation == null))
             {
                 foreach (AnimationState animationState in animation)
                 {
                     animationState.time = 0f;
                 }
                 animation.Play();
             }
         }
         DestroyForTime[] componentsInChildren7 = oEffect.GetComponentsInChildren <DestroyForTime>(true);
         for (int num = 0; num < componentsInChildren7.Length; num++)
         {
             DestroyForTime destroyForTime = componentsInChildren7[num];
             if (!(destroyForTime == null))
             {
                 destroyForTime.Reset();
             }
         }
     }
 }
コード例 #13
0
 void OnDisable()
 {
     particleSystemToReplay.Clear();
 }
コード例 #14
0
 void Awake()
 {
     ParticleCube = GetComponent <ParticleSystem>();
     ParticleCube.Stop();
     ParticleCube.Clear();
 }
コード例 #15
0
    protected override void UpdateActor()
    {
        base.UpdateActor();

        if (movementComp == null)
        {
            return;
        }

        // Determine facing based on the movement speed
        float xVelocity = movementComp.xVel();

        if (xVelocity < -0.02f)
        {
            cachedAnimData.mirroring = Facing.left;
        }
        else if (xVelocity > 0.02f)
        {
            cachedAnimData.mirroring = Facing.right;
        }

        cachedAnimData.speed = movementComp.NormalizedVel();

        if (Time.time - lastDamageTime > damageColorFlashLength && spriteRenderer.color != Color.white)
        {
            spriteRenderer.color = Color.white;
        }

        // Update jump offset
        if (!bIsOnGround)
        {
            transform.position += new Vector3(0.0f, jumpVelocity * Time.deltaTime, 0.0f);
            jumpVelocity       -= 9.8f * Time.deltaTime;

            if (shadowTransform != null)
            {
                shadowTransform.position = new Vector3(transform.position.x, groundHeightForJump, 0.0f);
            }

            if (transform.position.y - GetBaseOffset().y < groundHeightForJump)
            {
                transform.position = new Vector3(transform.position.x, groundHeightForJump + GetBaseOffset().y, 0.0f);
                bIsOnGround        = true;
                jumpVelocity       = 0.0f;
                movementComp.SetMovemetCollision(true);
            }
        }

        // The following things should only be updated when the game is not paused for whatever reason
        bool bIsPaused = world.GetIsCombatPaused();

        if (!bIsPaused)
        {
            // Allows abilities to modify current visibility ratings
            if (bCanModifyVisibilty)
            {
                visibility = GetVisiblityRating();
            }

            // Update all active abilities and check any restrictions the place on the pawn
            for (int i = abilitiesInUse.Count - 1; i >= 0; i--)
            {
                abilitiesInUse[i].Tick();
            }

            // Update the active effects. All effects are considered active, and the class itself is the one handles timing functionality
            for (int i = 0; i < activeEffects.Length; i++)
            {
                if (activeEffects[i].duration > 0.0f)
                {
                    activeEffects[i].Update();
                }
                else
                {
                    // Stop any paticle systems for an effect that has ended
                    if (i == (int)EffectType.Poison && poisonEffectSystem != null && poisonEffectSystem.isPlaying)
                    {
                        poisonEffectSystem.Stop();
                        poisonEffectSystem.Clear();
                    }
                    if (i == (int)EffectType.Bleeding && bleedEffectSystem != null && bleedEffectSystem.isPlaying)
                    {
                        bleedEffectSystem.Stop();
                        poisonEffectSystem.Clear();
                    }
                    if (i == (int)EffectType.Burning && fireEffectSystem != null && fireEffectSystem.isPlaying)
                    {
                        fireEffectSystem.Stop();
                        fireEffectSystem.Clear();
                    }
                }
            }

            // Check all items in inventory for effects
            if (bItemsCauseEffects)
            {
                foreach (Item itemInInventory in inventory.Items())
                {
                    if (itemInInventory.bIsActive)
                    {
                        itemInInventory.UpdateEffect(this);
                    }
                }
            }
        }
    }
コード例 #16
0
 void destroyParticle()
 {
     testParticle.Stop();
     testParticle.Clear();
 }
コード例 #17
0
ファイル: LaserController.cs プロジェクト: Xamdes/Electrogen
    // Update is called once per frame
    void Update()
    {
        if ((isHitOne || isHitTwo) && !start)
        {
            isHit = true;
            if (transmitOutWatts > 0.0f)
            {
                particles.Play(true);
            }
        }
        else if (!start)
        {
            isHit = false;
            particles.Pause(true);
            particles.Clear(true);
        }
        if (start)
        {
            transmitOutWatts = suppliedWatts;
            particles.Play(true);
        }
        else
        {
            transmitOutWatts = (transmitInWattsOne + transmitInWattsTwo - requiredWatts + suppliedWatts) * ampMultiplier;
        }

        //Finish
        if (finish)
        {
            if (isHit)
            {
                if (transmitOutWatts >= 0.0f)
                {
                    particles.Play(true);
                    control.SetYouWin(true);
                }
                else
                {
                    particles.Pause(true);
                    particles.Clear(true);
                    control.SetYouWin(false);
                }
            }
            else
            {
                control.SetYouWin(false);
            }
        }


        if (isSelected)
        {
            GetComponent <MeshRenderer>().material = whileSelected;
        }
        else
        {
            GetComponent <MeshRenderer>().material = notSelected;
        }

        //FireLaser
        bool forwardRight = true;

        foreach (LineRenderer a in lines)
        {
            coroutine    = FireLaser(a, forwardRight);
            forwardRight = !forwardRight;
            if (transmitOutWatts > 0.0f && (start || isHit))
            {
                StopCoroutine(coroutine);
                StartCoroutine(coroutine);
                if (!isSelected && !start && !finish)
                {
                    GetComponent <MeshRenderer>().material = whilePowered;
                }
            }
            else
            {
                StopCoroutine(coroutine);
                a.enabled = false;
            }
        }
    }
コード例 #18
0
                // Simulates full-circle back to current position.

                public void loopback(ParticleSystem particleSystem)
                {
                    // Lock random seed.

                    bool autoRandomSeed = particleSystem.useAutoRandomSeed;

                    // Save state before set.

                    ParticlePlaybackState state;

                    if (particleSystem.isPlaying)
                    {
                        state = ParticlePlaybackState.Playing;
                    }
                    else if (particleSystem.isPaused)
                    {
                        state = ParticlePlaybackState.Paused;
                    }
                    else
                    {
                        state = ParticlePlaybackState.Stopped;
                    }

                    // DON'T RESTART the simulation.
                    // Instead, stop, play, then simulate to time.

                    // Keep last false in Simulate to prevent restarts.
                    // Else, particles will pop in and out...

                    // Also requires clear in that case.

                    particleSystem.Stop(false);
                    particleSystem.Clear(false);

                    particleSystem.randomSeed = (uint)particleRandomSeed;

                    particleSystem.Play(false);

                    particleSystem.Simulate(particlePlaybackPosition, false, false);

                    // Resume from saved playback state.

                    particleSystem.Pause();
                    particleSystem.useAutoRandomSeed = autoRandomSeed;

                    switch (state)
                    {
                    case ParticlePlaybackState.Playing:
                    {
                        particleSystem.Play(false);

                        break;
                    }

                    case ParticlePlaybackState.Paused:
                    {
                        particleSystem.Pause(false);

                        break;
                    }

                    case ParticlePlaybackState.Stopped:
                    {
                        particleSystem.Stop(false);

                        break;
                    }
                    }
                }
コード例 #19
0
    private void Update()
    {
#if DEBUG
        m_spawnSiegeMinion = spawnSiegeMinion;
        m_reinforcements   = reinforcements;
        m_towerMovement    = towerMovement;
        m_selfRecover      = selfRecover;
        m_huntHero         = huntHero;
        m_upgradeSiege     = upgradeSiege;
        m_extraSiegeMinion = extraSiegeMinion;
        m_lastResort       = lastResort;
#endif
        if (!Hero.activeSelf)
        {
            lazer.autofire = false;
        }
        remainingHealth = redPortal.HP;
        dangerTreshold  = 90.0f - GameManager.Instance.Timer * 0.044444444f - redPortal.HP *
                          redPortal.InvMAXHP * 50.0f + (5 - towersRemaining) * 9.0f;
        lazer.SiegeProjectileDamage = portalInfo.Damage * towersRemaining;
        if (!LastResortActive)
        {
            switch (GetTriggered)
            {
            case DangerLevel.EXTREME:
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = spawnSiegeMinion = selfRecover = true;
                siegeTime          = reinforcementsTime = 10.0f;
                selfRecoveryBase   = 30.0f;
                break;

            case DangerLevel.CRITICAL:
                extraSiegeMinion     = upgradeSiege = huntHero = towerMovement = reinforcements =
                    spawnSiegeMinion = selfRecover = true;
                lastResort           = false;
                reinforcementsTime   = 20.0f;
                siegeTime            = 15.0f;
                selfRecoveryBase     = 20.0f;
                break;

            case DangerLevel.HIGH:
                towerMovement      = reinforcements = spawnSiegeMinion = selfRecover = true;
                huntHero           = false;
                extraSiegeMinion   = upgradeSiege = true;
                lastResort         = false;
                reinforcementsTime = 40.0f;
                siegeTime          = 25.0f;
                selfRecoveryBase   = 15.0f;
                break;

            case DangerLevel.MODERATE:
                towerMovement      = reinforcements = spawnSiegeMinion = selfRecover = true;
                huntHero           = false;
                upgradeSiege       = true;
                lastResort         = extraSiegeMinion = false;
                reinforcementsTime = 60.0f;
                siegeTime          = 40.0f;
                selfRecoveryBase   = 10.0f;
                break;

            case DangerLevel.MEDIUM:
                selfRecover        = false;
                towerMovement      = reinforcements = spawnSiegeMinion = true;
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = false;
                reinforcementsTime = 80.0f;
                siegeTime          = 60.0f;
                break;

            case DangerLevel.LOW:
                selfRecover        = false;
                spawnSiegeMinion   = true;
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = false;
                siegeTime          = reinforcementsTime = 80.0f;
                break;

            case DangerLevel.MINIMAL:
                lastResort         = extraSiegeMinion = upgradeSiege = huntHero = towerMovement =
                    reinforcements = spawnSiegeMinion = selfRecover = false;
                siegeTime          = reinforcementsTime = 80.0f;
                break;

            default:
                break;
            }
        }
        if (spawnSiegeMinion)
        {
            siegeTimer -= Time.deltaTime;
        }
        if (reinforcements)
        {
            reinforcementsTimer -= Time.deltaTime;
        }
        if (lastResort && lastResortTimer >= 15.0f)
        {
            LastResortActive = true;
        }
        if (redPortal.Alive && selfRecover)
        {
            redPortal.HP = remainingHealth + CalcSelfRecovery * Time.deltaTime;
            if (LastResortActive)
            {
                lrpPs.Play();
                lastResortTimer  -= Time.deltaTime;
                selfRecoveryBase *= 3.0f;
                redPortal.HP      = remainingHealth + CalcSelfRecovery * Time.deltaTime;
                if (lastResortTimer <= 0.0f)
                {
                    LastResortActive = false;
                }
            }
            else
            {
                lrpPs.Stop();
                lrpPs.Clear();
                lastResortTimer = System.Math.Min(20.0f, lastResortTimer + 0.6f * Time.deltaTime);
            }
        }
        if (spawnSiegeMinion && siegeTimer <= 0.0f)
        {
            SpawnSiegeMinion(Team.RED_TEAM, heroPresence);
            if (extraSiegeMinion)
            {
                SpawnSiegeMinion(Team.RED_TEAM, heroPresence);
            }
            siegeTimer = siegeTime;
        }
        if (reinforcements && reinforcementsTimer <= 0.0f)
        {
            SetupMinion(Instantiate(redCaster, redPortal.LeftSpawn[0].position, faceDown), Path
                        .SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.LeftSpawn[3].position, faceDown),
                        Path.SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.LeftSpawn[1].position, faceDown), Path.
                        SOUTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redCaster, redPortal.MidSpawn[0].position, faceLeft), Path.
                        CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.MidSpawn[4].position, faceLeft), Path
                        .CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.MidSpawn[2].position, faceLeft), Path.
                        CENTER_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redCaster, redPortal.RightSpawn[0].position, faceUp), Path.
                        NORTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redStriker, redPortal.RightSpawn[4].position, faceUp), Path
                        .NORTH_PATH, Team.RED_TEAM);
            SetupMinion(Instantiate(redTank, redPortal.RightSpawn[2].position, faceUp), Path.
                        NORTH_PATH, Team.RED_TEAM);
            reinforcementsTimer = reinforcementsTime;
        }
        if (Vector3.Distance(Hero.transform.position, redPortal.transform.position) <= 210.0f)
        {
            heroPresence = HeroLocation.Close;
        }
        else if (Hero.transform.position.z > UpperSplit.transform.position.z)
        {
            heroPresence = HeroLocation.TOP_Lane;
        }
        else if (Hero.transform.position.z < LowerSplit.transform.position.z)
        {
            heroPresence = HeroLocation.BOT_Lane;
        }
        else
        {
            heroPresence = HeroLocation.MID_Lane;
        }
        redPortal.DmgDamp = 10.0f * towersRemaining;
    }
コード例 #20
0
    private void Shoot()
    {
        MuzzleFlash.Clear();
        MuzzleFlash.Play();
        mAudioSrc.Play();

        pelletArray = new Vector3[pelletNumber];
        Vector3 pellet = transform.forward;
        float   pelletRotate;

        for (int i = 0; i < pelletNumber; i++)
        {
            pelletArray[i] = Quaternion.AngleAxis(10, transform.up) * pellet;
            pelletRotate   = (360 * i / pelletNumber + 360 / pelletNumber * 2);
            pelletArray[i] = Quaternion.AngleAxis(pelletRotate, transform.forward) * pelletArray[i];
        }



        RaycastHit[] hitArray = new RaycastHit[pelletNumber + 1];


        if (randomSpread)
        {
            randomiseShots();
        }


        if (Physics.Raycast(transform.position, transform.forward, out hitArray[0], range))
        {
            Debug.Log(hitArray[0].transform.name);

            Target target = hitArray[0].transform.GetComponent <Target>();
            if (target != null)
            {
                target.TakeDamage(damage);
            }
            if (hitArray[0].rigidbody != null)
            {
                hitArray[0].rigidbody.AddForce(hitArray[0].normal * impactForce);
            }

            GameObject impactGo = Instantiate(impact, hitArray[0].point, Quaternion.LookRotation(hitArray[0].normal));
            Destroy(impactGo, 1f);
        }


        for (int i = 1; i <= pelletNumber; i++)
        {
            if (Physics.Raycast(transform.position, pelletArray[i - 1], out hitArray[i], range))
            {
                Debug.Log(hitArray[i].transform.name + " " + i);

                Target target = hitArray[i].transform.GetComponent <Target>();
                if (target != null)
                {
                    target.TakeDamage(damage);
                }
                if (hitArray[i].rigidbody != null)
                {
                    hitArray[i].rigidbody.AddForce(hitArray[i].normal * impactForce);
                }

                GameObject impactGo = Instantiate(impact, hitArray[i].point, Quaternion.LookRotation(hitArray[i].normal));
                Destroy(impactGo, 1f);
            }
        }
    }
コード例 #21
0
 public override void OnObjectReuse()
 {
     myParticleSystem = this.gameObject.GetComponent <ParticleSystem>();
     myParticleSystem.Clear();
     myParticleSystem.Play();
 }
コード例 #22
0
ファイル: Torch.cs プロジェクト: dklee159/MazeEscape
 // Start is called before the first frame update
 void Start()
 {
     playertrig = line.GetComponent <Line>();
     particle.Clear();
 }
コード例 #23
0
 public void Activate()
 {
     AudioManager.Instance.Play("Explosion01");
     particles.Clear();
     particles.Play();
 }
コード例 #24
0
 public static void ResetParticleSystem(ParticleSystem ps)
 {
     ps.Stop();
     ps.Simulate(0f, true, true);
     ps.Clear();
 }
コード例 #25
0
ファイル: Support.cs プロジェクト: goldenmat/ogd-project
    // Update is called once per frame
    void Update()
    {
        Ray pos = cam.ScreenPointToRay(Input.mousePosition);

        Debug.DrawRay(pos.origin, pos.direction * 30, Color.yellow, 1);
        RaycastHit hit;

        if (Physics.Raycast(pos, out hit))
        {
            bas   = hit.point;
            bas.y = 0;
            _redemption.transform.position = bas;
            _taric.transform.position      = bas;
        }

        if (_pc.getLuth() < 20)
        {
            enoughluth = false;
        }
        else
        {
            enoughluth = true;
        }

        if (Input.GetKeyDown(KeyCode.Q))
        {
            _slowMesh.enabled = true;
        }


        if (Input.GetKeyUp(KeyCode.Q))
        {
            _slowMesh.enabled = false;

            if (usableQ && enoughluth)
            {
                usableQ = false;

                GetComponent <PlayerController>().DecreaseLùth(Qcost);

                _slowColl.enabled = true;

                coroutineQ = FieldSlowDuration(_slowColl);
                StartCoroutine(coroutineQ);

                coroutineCDQ = CooldownQ(10.0f);
                StartCoroutine(coroutineCDQ);
            }
        }


        if (Input.GetKeyDown(KeyCode.W))
        {
            _redemptionMesh.enabled = true;
        }


        if (Input.GetKeyUp(KeyCode.W))
        {
            _redemptionMesh.enabled = false;

            if (usableW && enoughluth)
            {
                usableW = false;

                GetComponent <PlayerController>().DecreaseLùth(Wcost);

                _TransformPsW.transform.position = new Vector3(_redemption.transform.position.x, 0.5f, _redemption.transform.position.z);
                _psW.Clear();
                _psW.Simulate(0.0f, true, true);
                _psW.Play();

                coroutineCasting = CastingDuration(3.0f);
                StartCoroutine(coroutineCasting);

                coroutineCDW = CooldownW(10.0f);
                StartCoroutine(coroutineCDW);
            }
        }

        /*if (visibileRedemption)
         * {
         *  coroutineW = Instant(_redemptionColl, visibileRedemption);
         *  StartCoroutine(coroutineW);
         * }*/



        if (Input.GetKeyDown(KeyCode.R))
        {
            _taricMesh.enabled = true;
        }

        if (usableR)
        {
            if (Input.GetKeyUp(KeyCode.R))
            {
                GetComponent <PlayerController>().DecreaseLùth(maxluth);
                _taricMesh.enabled = false;

                _taricColl.enabled = true;

                coroutineCasting1 = Instant(_taricColl, visibileTaric);
                StartCoroutine(coroutineCasting1);
            }
        }

        /*if (visibileTaric)
         * {
         *  coroutineR = Instant(_taricColl, visibileTaric);
         *  StartCoroutine(coroutineR);
         * }*/
    }
コード例 #26
0
 protected void OnDeath()
 {
     healParticles.Stop();
     healParticles.Clear();
 }
コード例 #27
0
ファイル: GameState.cs プロジェクト: sorlok/LD41
    public void ReactToStamp(int stampId)       // 1, 2, 3 for stamp ID
    // Beginning of game: show the timer, show the dialogue box
    {
        if (CurrState == ActState.Nothing)
        {
            //TEMP:DEBUG:TESTING
            //StartFansActionState();return;
            //END:TEMP:DEBUG:TESTING


            PlayButtonSound();

            // Start Invisible
            StoryTxtHeader.text = "Date Action";
            StoryTxt.text       = "";
            ShowBoxes(null, null, null);

            // First interpolation
            interpEndPos   = PhasePanel.transform.position;
            interpStartPos = PhasePanel.transform.position + new Vector3(1.3f, 0, 0);
            interpEndSz    = new Vector3(1, 1, 1);
            interpStartSz  = new Vector3(0.1f, 0.1f, 0.1f);
            interpTarget   = PhasePanel.transform;
            PhasePanel.SetActive(true);

            // Second interpolation
            interpEndPos2   = DialoguePanel.transform.position;
            interpStartPos2 = DialoguePanel.transform.position + new Vector3(0, 0, -0.5f);
            interpEndSz2    = new Vector3(1, 1, 1);
            interpStartSz2  = new Vector3(0.1f, 0.1f, 0.1f);
            interpTarget2   = DialoguePanel.transform;
            DialoguePanel.SetActive(true);

            // Third interpolation
            interpEndPos3   = AttributesPanel.transform.position;
            interpStartPos3 = AttributesPanel.transform.position + new Vector3(0, 0, 1f);
            interpEndSz3    = new Vector3(1, 1, 1);
            interpStartSz3  = new Vector3(0.1f, 0.1f, 0.1f);
            interpTarget3   = AttributesPanel.transform;
            AttributesPanel.SetActive(true);

            // Set up the interpolation
            interpStartTime   = Time.time;
            interpTotalLength = Vector3.Distance(interpStartPos, interpEndPos);

            // Update all
            updateInterpolation();

            // Temp
            phaseHandler.UpdateColoring();

            CurrState = ActState.DoingInterp;
            return;
        }

        // Phase 1C: Try to move to new location
        if (CurrState == ActState.MoveToNewLocation)
        {
            // Go back
            if (TooSoonToMove())
            {
                // Fade text to player's turn
                CurrState      = ActState.FadingTextOut;
                AfterFadeState = ActState.PlayerActionSelect;
            }
            else
            {
                if (phaseHandler.thisHour == 10)
                {
                    // TODO: End date code here.
                    ShowFinalScreen();
                }
                else
                {
                    // Fade back to start
                    CurrState      = ActState.FadingTextOut;
                    AfterFadeState = ActState.PlayerActionSelect;
                }
            }

            PlayButtonSound();
            return;
        }

        // Phase 1: Select talk, tweet, or move
        if (CurrState == ActState.PlayerActionSelect)
        {
            PlayButtonSound();


            if (stampId == 1)
            {
                // Talk to date
                // Fade out text, fade in new text
                CurrState      = ActState.FadingTextOut;
                AfterFadeState = ActState.ChooseInteractTalk;
            }
            else if (stampId == 2)
            {
                // Tweet @ fans
                StoryTxt.text += "\n\nUse the mouse to aim; click to fire off a tweet.";

                tweetHandler.StartTweeting();
            }
            else if (stampId == 3)
            {
                // Move date location
                CurrState      = ActState.FadingTextOut;
                AfterFadeState = ActState.MoveToNewLocation;
            }

            return;
        }

        // Phase 1.A - Date reacts to dialogue choice
        if (CurrState == ActState.ChooseInteractTalk)
        {
            CurrState      = ActState.FadingTextOut;
            AfterFadeState = ActState.TalkDateViewResponse;

            ChoiceParticles.GetComponent <ParticleOrientor>().OrientParticles();
            ChoiceParticles.Clear();
            ChoiceParticles.gameObject.SetActive(true);
            // Particles
            LastDateResponse = new char[] { 'G', 'B', 'N' }[rng.Next(3)];
            if (LastDateResponse == 'G')
            {
                ChoiceParticles.GetComponent <Renderer> ().material = GoodOptionTexture;


                MapHandler.GetComponent <MapHandler> ().LeadPlayerScript.SelfEsteem += GetAtmoMod(2);
            }
            else if (LastDateResponse == 'N')
            {
                ChoiceParticles.GetComponent <Renderer> ().material = NeutralOptionTexture;


                MapHandler.GetComponent <MapHandler> ().LeadPlayerScript.SelfEsteem += GetAtmoMod(1);
                //MapHandler.GetComponent<MapHandler> ().CreateHeart (tileX, tileY);
            }
            else
            {
                ChoiceParticles.GetComponent <Renderer> ().material = BadOptionTexture;
                MapHandler.GetComponent <MapHandler> ().LeadPlayerScript.SelfEsteem -= 1;
            }

            // TODO:TEMP:DEBUG
            //MapHandler.GetComponent<MapHandler> ().LeadPlayerScript.SelfEsteem -= 99;


            PlayButtonSound();

            ChoiceParticles.Play();
            return;
        }

        // Phase 1.B - Saw date react, move to next phase
        if (CurrState == ActState.TalkDateViewResponse)
        {
            CurrState      = ActState.FadingTextOut;
            AfterFadeState = ActState.DateAction;
            PlayButtonSound();
            return;
        }

        // Phase 2 - Ready to switch to fan phase?
        if (CurrState == ActState.DateActShowReward)
        {
            CurrState      = ActState.FadingTextOut;
            AfterFadeState = ActState.FansAction;
            PlayButtonSound();
            return;
        }

        // Phase 3 - Ready to switch back to player phase?
        if (CurrState == ActState.WaitingFanAckFromPlayer)
        {
            //Update Phase Clock
            phaseHandler.UpdateMinute();
            phaseHandler.UpdateTime();

            // Add some new fans
            MapHandler.GetComponent <MapHandler>().SpawnFans(3);

            // Fade text to player's turn
            CurrState      = ActState.FadingTextOut;
            AfterFadeState = ActState.PlayerActionSelect;
            PlayButtonSound();
            return;
        }
    }
コード例 #28
0
 private void OnDisable()
 {
     particle.Clear();
     particle.Play();
 }
コード例 #29
0
 void OnEnable()
 {
     visualAid.Clear();
 }
コード例 #30
0
    private void Update()
    {
        if (Input.GetKeyDown(KeyCode.Escape))
        {
            if (Time.timeScale > 0f)
            {
                GameManager.PauseMenuObj.SetActive(true);
                Time.timeScale = 0f;
            }
            else
            {
                GameManager.PauseMenuObj.SetActive(false);
                Time.timeScale = 1f;
            }
        }

        if (Input.GetKey(KeyCode.Mouse0) && Time.time >= shootTime && !GameManager.onShuttle)
        {
            if (curFr == fireRate.low)
            {
                if (curType == GameManager.shipType.fighter)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay * lowFireMod;
                    Instantiate(bullet, transform.position, transform.rotation, null);
                }
                else if (curType == GameManager.shipType.scout)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay * lowFireMod * scoutFireMod;

                    for (int i = 0; i < 6; i++)
                    {
                        Instantiate
                            (shotgunBullet,                                                                                                                                              //Object
                            shotgunOrigin.transform.position + new Vector3(Random.Range(-.2f, .2f), 0, Random.Range(.2f, .2f)),                                                          //Position
                            Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + Random.Range(-15, 15), transform.rotation.eulerAngles.z)), //Rotation
                            null);                                                                                                                                                       //Parent
                    }
                }

                else if (curType == GameManager.shipType.tank)
                {
                    if (!tankCharging)
                    {
                        tankChargeTime = Time.time + shootDelay * lowFireMod * tankFireMod;
                        tankChargeSys.Play();
                    }
                    tankCharging = true;

                    if (Time.time >= tankChargeTime && !tankCharged)
                    {
                        Debug.Log("Tank Charged");
                        tankChargeSys.Stop();
                        tankChargeSys.Clear();
                        chargeObj.SetActive(true);
                        tankCharged = true;
                    }
                }
            }
            else if (curFr == fireRate.med)
            {
                if (curType == GameManager.shipType.fighter)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay;
                    Instantiate(bullet, transform.position, transform.rotation, null);
                }
                else if (curType == GameManager.shipType.scout)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay * scoutFireMod;
                    for (int i = 0; i < 6; i++)
                    {
                        Instantiate
                            (shotgunBullet,                                                                                                                                              //Object
                            shotgunOrigin.transform.position + new Vector3(Random.Range(-.2f, .2f), 0, Random.Range(.2f, .2f)),                                                          //Position
                            Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + Random.Range(-15, 15), transform.rotation.eulerAngles.z)), //Rotation
                            null);                                                                                                                                                       //Parent
                    }
                }
                else if (curType == GameManager.shipType.tank)
                {
                    if (!tankCharging)
                    {
                        tankChargeTime = Time.time + shootDelay * tankFireMod;
                        tankChargeSys.Play();
                    }
                    tankCharging = true;

                    if (Time.time >= tankChargeTime && !tankCharged)
                    {
                        Debug.Log("Tank Charged");
                        tankChargeSys.Stop();
                        tankChargeSys.Clear();
                        chargeObj.SetActive(true);
                        tankCharged = true;
                    }
                }
            }
            else if (curFr == fireRate.high)
            {
                if (curType == GameManager.shipType.fighter)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay;

                    Instantiate(bullet, powerupGeo[2].transform.GetChild(0).transform.position, transform.rotation, null);

                    Instantiate(bullet, powerupGeo[2].transform.GetChild(1).transform.position, transform.rotation, null);
                }
                else if (curType == GameManager.shipType.scout)
                {
                    AudioPlayer.lasShot.time = 0.105f;
                    AudioPlayer.lasShot.Play();
                    shootTime = Time.time + shootDelay * highFireMod * scoutFireMod;
                    for (int i = 0; i < 6; i++)
                    {
                        Instantiate
                            (shotgunBullet,                                                                                                                                              //Object
                            shotgunOrigin.transform.position + new Vector3(Random.Range(-.2f, .2f), 0, Random.Range(.2f, .2f)),                                                          //Position
                            Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + Random.Range(-15, 15), transform.rotation.eulerAngles.z)), //Rotation
                            null);                                                                                                                                                       //Parent
                    }
                }
                else if (curType == GameManager.shipType.tank)
                {
                    if (!tankCharging)
                    {
                        tankChargeTime = Time.time + shootDelay * highFireMod * tankFireMod;
                        tankChargeSys.Play();
                    }
                    tankCharging = true;

                    if (Time.time >= tankChargeTime && !tankCharged)
                    {
                        Debug.Log("Tank Charged");
                        tankChargeSys.Stop();
                        tankChargeSys.Clear();
                        chargeObj.SetActive(true);
                        tankCharged = true;
                    }
                }
            }
            else if (curFr == fireRate.pride)
            {
                AudioPlayer.lasShot.time = 0.105f;
                AudioPlayer.lasShot.Play();
                shootTime = Time.time + shootDelay * highFireMod;

                Instantiate(prideBullet, transform.position, Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y + 10, transform.rotation.eulerAngles.z)), null);
                Instantiate(prideBullet, transform.position, transform.rotation, null);
                Instantiate(prideBullet, transform.position, Quaternion.Euler(new Vector3(transform.rotation.eulerAngles.x, transform.rotation.eulerAngles.y - 10, transform.rotation.eulerAngles.z)), null);
            }
        }//Getkey mouse 0 end

        if (Input.GetKeyUp(KeyCode.Mouse0))
        {
            if (tankCharged)
            {
                Instantiate(railgunBullet, transform.position, transform.rotation, null);
            }

            chargeObj.SetActive(false);
            tankCharged  = false;
            tankCharging = false;
            tankChargeSys.Stop();
            tankChargeSys.Clear();
        }
    } //Update end