示例#1
0
        protected override void Activate()
        {
            // Spawn animation.
            SmokeEffect anim = Target.GetComponentInChildren <SmokeEffect>();

            if (anim == null)
            {
                _followingAnimation =
                    SpawnManager.Instance.SpawnFollowingAnimationLoop(((ScriptableSpecialItemBombReplicator)Data).BuffEffectPrefab, Target.gameObject, new Vector3(0.4f, 0.7f, 0f), Quaternion.identity);
            }
            else
            {
                _followingAnimation = anim.gameObject;
            }

            // Edit number in the smoke animation.
            _followingAnimation.GetComponent <SmokeEffect>().TextLabel.text =
                "" + (Int32.Parse(_followingAnimation.GetComponent <SmokeEffect>().TextLabel.text) + ((ScriptableSpecialItemBombReplicator)Data).AdditionalBombs);

            // Apply status effect.
            ((Player)Target).BombMaxAllowedDeploys += ((ScriptableSpecialItemBombReplicator)Data).AdditionalBombs;

            // Play sound.
            SoundManager.Instance.PlaySingleSfx(((ScriptableSpecialItemBombReplicator)Data).StartSfx);
        }
示例#2
0
    void SmokeMoniter()
    {
        if (smokeTimer > 0)
        {
            smokeTimer -= Time.deltaTime;
        }
        else
        {
            if (mySmoke.Count < 5)
            {
                GameObject  g = (GameObject)Instantiate(CommonObjectsStore.me.smokeEffect, getPosForSmoke(), Quaternion.Euler(0, 0, 0));
                SmokeEffect s = g.GetComponent <SmokeEffect> ();
                s.myManager = this.GetComponent <SmokeManager> ();
                mySmoke.Add(g);
                smokeTimer = 0.3f;
            }
        }

        foreach (GameObject g in mySmoke)
        {
            if (g == null)
            {
                mySmoke.Remove(g);
                return;
            }
        }
    }
示例#3
0
    void shouldWeCreateMoreSmoke()
    {
        if (myManager == null)
        {
            return;
        }

        if (myManager.canWeCreateSmoke() == false)
        {
            return;
        }

        int r = Random.Range(1, 1000);

        if (r > 975)
        {
            Vector3 pos = myManager.getPositionForSmoke();
            if (isTearGas == false)
            {
                GameObject  g = (GameObject)Instantiate(CommonObjectsStore.me.smokeEffect, pos, Quaternion.Euler(0, 0, Random.Range(0, 360)));
                SmokeEffect s = g.GetComponent <SmokeEffect> ();
                s.myManager = myManager;
            }
            else
            {
                GameObject  g = (GameObject)Instantiate(CommonObjectsStore.me.tearGasEffect, pos, Quaternion.Euler(0, 0, Random.Range(0, 360)));
                SmokeEffect s = g.GetComponent <SmokeEffect> ();
                s.myManager = myManager;
            }
        }
    }
示例#4
0
文件: Enemy.cs 项目: SonGit/VRDino
    protected void SmokeEffect(Transform pos)
    {
        SmokeEffect smokeEffect = ObjectPool.instance.GetSmokeEffect();

        smokeEffect.transform.position = pos.position;
        smokeEffect.Live();
    }
示例#5
0
    public void detonate()
    {
        if (created == false)
        {
            GameObject g = Instantiate(toCreateOnDetonation, this.transform.position, this.transform.rotation);

            if (isSmoke == true)
            {
                SmokeEffect s = g.GetComponent <SmokeEffect> ();
                s.myManager = this.gameObject.GetComponent <SmokeManager> ();
                this.GetComponent <SmokeManager> ().smokeOriginPoint = this.transform.position;
            }
            if (impactSFX == null)
            {
            }
            else
            {
                GameObject g2 = new GameObject();
                g2.transform.position = this.transform.position;
                AudioController au2 = g2.AddComponent <AudioController>();
                au2.playSound(impactSFX);
            }
            created = true;
        }
        if (destroyOnExplode == true)
        {
            Destroy(this.gameObject);
        }
    }
示例#6
0
            private void Start()
            {
                _audio = GetComponent<AudioSource>();
                _audio.PlayOneShot(_sfx[0]);

                explosion = GetComponent<ExplosionAfter>();
                smokeEffect = GetComponent<SmokeEffect>();
            }
示例#7
0
    private void Start()
    {
        _smokeEffect = GetComponentInChildren <SmokeEffect>();

        var farmTemplate = siloTemplates[Random.Range(0, siloTemplates.Length)];
        var farm         = Instantiate(farmTemplate, transform, false);

        _smokeEffect.PlayOnNextHit();
        farm.transform.Rotate(new Vector3(0, Random.value * 360, 0));
        LaunchFromAbove();
    }
示例#8
0
    void Explose(Vector3 position)
    {
        ExplosionPhysique instance = Instantiate(Explosion, position, new Quaternion()).GetComponent <ExplosionPhysique>();

        instance.NumPlayer = NumPlayer;
        foreach (var SmokeEffect in GetComponentsInChildren <ParticleSystem>())
        {
            SmokeEffect.transform.parent = null;
            //SmokeEffect.transform.localScale = SmokeEffect.transform.localScale / transform.localScale.magnitude;
            Destroy(SmokeEffect.gameObject, SmokeEffect.startLifetime);
            SmokeEffect.Stop();
        }
        Destroy(gameObject);
    }
示例#9
0
    public void LoadTileAnimations()
    {
        //This function loads all tile animations into the tileEffects map and then hides the visual effects
        //loading all the effects
        HeavyRainEffect rainEffect = GameObject.Find("HeavyRainEffect").GetComponent <HeavyRainEffect>();

        tileEffects.Add("rain", rainEffect);
        FallingObject fallingObject = GameObject.Find("FallingObject").GetComponent <FallingObject>();

        tileEffects.Add("fall", fallingObject);
        RisingObject risingObject = GameObject.Find("JerryCan").GetComponent <RisingObject>();

        tileEffects.Add("jerry", risingObject);
        LeftMovingObject slideObject = GameObject.Find("LeftMovingObject").GetComponent <LeftMovingObject>();

        tileEffects.Add("slide", slideObject);
        SmokeEffect smokeEffect = GameObject.Find("SmokeEffect").GetComponent <SmokeEffect>();

        tileEffects.Add("smoke", smokeEffect);
        LeftMovingObject fishObject = GameObject.Find("FishEffect").GetComponent <LeftMovingObject>();

        tileEffects.Add("fish", fishObject);
        LeftMovingObject screenObject = GameObject.Find("SlidingScreenEffect").GetComponent <LeftMovingObject>();

        tileEffects.Add("screen", screenObject);
        FallingObject soapObject = GameObject.Find("FallingSoapEffect").GetComponent <FallingObject>();

        tileEffects.Add("soap", soapObject);
        WinEffect winEffect = GameObject.Find("WinEffect").GetComponent <WinEffect>();

        tileEffects.Add("win", winEffect);
        LeftMovingObject tongueObject = GameObject.Find("TongueEffect").GetComponent <LeftMovingObject>();

        tileEffects.Add("tongue", tongueObject);


        //resizing and hiding the effects
        foreach (string effect in tileEffects.Keys)
        {
            //set parameters of effects
            float[] animParams = GameData.GetAnimationParams();
            tileEffects[effect].setParameters(animParams[0], animParams[1], animParams[2], animParams[3]);

            //resize effects
            tileEffects[effect].resizeEffect();

            //hide effects
            tileEffects[effect].hideEffect();
        }
    }
示例#10
0
    public override void TimerOver()
    {
        base.TimerOver();

        //smokeRadius, smokeDamage & smokeSpeedDivide is given by ShootSmokeBomb script. (the tower that shoots)
        //when the timer expires the bomb explodes.
        //and this object spawns smoke
        GameObject  smokeObject = Instantiate(smoke, transform.position, transform.rotation) as GameObject;
        SmokeEffect smokeEffect = smokeObject.GetComponent <SmokeEffect>();

        smokeEffect.StartSmoke(smokeRadius, smokeDamage, smokeSpeedDivide);

        Destroy(this.gameObject);
    }
示例#11
0
    void Rpc_DoExplosion(Vector3 position)
    {
        NetworkedExplosion instance = Instantiate(Explosion, position, new Quaternion()).GetComponent <NetworkedExplosion>();

        instance.NumPlayer = NumPlayer;
        NetworkServer.Spawn(instance.gameObject);
        foreach (var SmokeEffect in GetComponentsInChildren <ParticleSystem>())
        {
            SmokeEffect.transform.parent = null;
            //SmokeEffect.transform.localScale = SmokeEffect.transform.localScale / transform.localScale.magnitude;
            Destroy(SmokeEffect.gameObject, SmokeEffect.startLifetime);
            SmokeEffect.Stop();
        }
        Destroy(gameObject);
    }
示例#12
0
    //to ray passing
    void isPlayerOnGround()
    {
        //to ray passing down position

        Debug.DrawRay(thisTrans.position, -Vector3.up * 0.15f, Color.red);

        if (Physics.Raycast(transform.position, -Vector3.up, out hit, 0.15f))
        {
            //Debug.Log ("name" + hit.collider.tag);
            //for ray hit castle ground
            if (playerAnimator.GetCurrentAnimatorStateInfo(0).IsName("Run"))
            {
                if (hit.collider.tag.Contains("ground1"))
                {
                    fireEffect.SetActive(true);                     //to fire effect disable
                    SmokeEffect.SetActive(false);                   //to smoke effect disable
                }

                //for ray hit forest ground
                else if (hit.collider.tag.Contains("ground2"))
                {
                    fireEffect.SetActive(false);                     //to fire effect disable
                    SmokeEffect.SetActive(true);                     //to smoke effect disable
                }
            }
            else
            {
                SmokeEffect.SetActive(false);                //to smoke effect disable
                fireEffect.SetActive(false);                 //to fire effect disable
            }
            isPlayerOnTheGround = true;
        }
        else
        {
            isPlayerOnTheGround = false;
            //if player is on Air
            SmokeEffect.SetActive(false);            //to smoke effect disable
            fireEffect.SetActive(false);             //to fire effect disable
        }
    }
示例#13
0
        public override void Init(RendererBase <ToyWorld> renderer, ToyWorld world, EffectSettings settings)
        {
            Settings = settings;

            if (Settings.EnabledEffects.HasFlag(RenderRequestEffect.Lights))
            {
                if (m_pointLightEffect == null)
                {
                    m_pointLightEffect = new PointLightEffect();
                }
            }

            if (Settings.EnabledEffects.HasFlag(RenderRequestEffect.Smoke))
            {
                if (m_smokeEffect == null)
                {
                    m_smokeEffect = renderer.EffectManager.Get <SmokeEffect>();
                }
                renderer.EffectManager.Use(m_smokeEffect); // Need to use the effect to set uniforms
                m_smokeEffect.SmokeColorUniform(new Vector4(Settings.SmokeColor.R, Settings.SmokeColor.G, Settings.SmokeColor.B, Settings.SmokeColor.A) / 255f);
            }
        }
示例#14
0
    void CreatePotionEffect(Vector3 position)
    {
        if (potionId == 0)
        {
            SmokeEffect smokepuff = Instantiate(GM.smokepuff) as SmokeEffect;
            smokepuff.transform.position = position;
        }
        if (potionId == 1)
        {
            FireballEffect fireball = Instantiate(GM.fireball) as FireballEffect;
            fireball.transform.position = position;
            if (enhancedRadius)
            {
                fireball.radius *= 2;
            }
        }
        if (potionId == 2)
        {
            TornadoEffect tornado = Instantiate(GM.tornado) as TornadoEffect;
            tornado.transform.position = position;
            if (enhancedRadius)
            {
                tornado.radius *= 2;
            }
        }
        if (potionId == 3)
        {
            BlizzardEffect blizzard = Instantiate(GM.blizzard) as BlizzardEffect;
            blizzard.transform.position = position;
            if (enhancedRadius)
            {
                blizzard.radius *= 2;
            }
        }
        if (potionId == 4)
        {
            LightningEffect lightning = Instantiate(GM.lightning) as LightningEffect;
            lightning.transform.position = position;
            if (enhancedRadius)
            {
                lightning.radius *= 2;
            }
        }
        if (potionId == 5)
        {
            ArcaneEffect arcane = Instantiate(GM.arcane) as ArcaneEffect;
            arcane.transform.position = position;
            if (enhancedRadius)
            {
                arcane.radius *= 2;
            }
        }
        if (potionId == 6)
        {
            PoisonEffect poison = Instantiate(GM.poison) as PoisonEffect;
            poison.transform.position = position;
            if (enhancedRadius)
            {
                poison.radius *= 2;
            }
        }

        PlaySound(source, sounds[1], true);
        StartCoroutine("DelayForDestroySelf");
        foreach (Transform child in transform)
        {
            if (child.GetComponent <Renderer>())
            {
                child.GetComponent <Renderer>().enabled = false;
            }
        }
    }
示例#15
0
 private void Start()
 {
     _smokeEffect = GetComponentInChildren <SmokeEffect>();
 }
示例#16
0
    void  FixedUpdate()
    {
        //isPlayerOnGround ();

        thisPosition = thisTrans.position;
        switch (presentPlayerState)
        {
        //for player in alive

        case playerStates.Alive:



            if (InputController.Static.isJump)
            {
                if (canDoubleJump)
                {
                    currentJumpSpeed = jumpSpeed * 0.5f;
                    canDoubleJump    = false;
                    playerAnimator.SetTrigger("DoubleJump");
                    jumpTimer = 0.0f;
                    onAirTime = Time.timeSinceLevelLoad;
                }
                else
                {
                    if (isPlayerOnTheGround)
                    {
                        currentJumpSpeed = jumpSpeed;
                        canDoubleJump    = true;
                        playerAnimator.SetTrigger("Jump");
                        jumpTimer = 0.0f;
                        jumpinfo.SetActive(false);
                        SoundController.Static.playSoundFromName("JUMP");                         //for jump sound
                        onAirTime = Time.timeSinceLevelLoad;
                    }
                }



                InputController.Static.isJump = false;
            }

            if (InputController.Static.isAttack)
            {
                attackinfo.SetActive(false);
                fireEffect.SetActive(false);
                SwordAnimator.SetTrigger("Rotate");
                playerAnimator.SetTrigger("Attack");
                SoundController.Static.playSoundFromName("Sword");                 //for sword sound

                InputController.Static.isAttack = false;
            }



            moveDirection = new Vector3(speed, currentJumpSpeed, 0);
            controller.Move(moveDirection * Time.deltaTime);

            jumpSpeedFalloff  = jumpCurve.Evaluate(jumpTimer);
            currentJumpSpeed -= jumpSpeedFalloff;
            jumpTimer        += Time.deltaTime;

            isPlayerOnGround();
            break;

        case playerStates.idle:
            break;

        //to player dead state
        case playerStates.dead:
            fireEffect.SetActive(false);
            SmokeEffect.SetActive(false);
            sword.SetActive(false);
            //player moving down
            moveDirection.y -= gravity * Time.deltaTime;
            moveDirection    = Vector3.MoveTowards(moveDirection, Vector3.zero, 0.09f);
            controller.Move(moveDirection * Time.deltaTime);

            SoundController.Static.bgSound.volume = 0;            //to bg sound
            //to resetting player moving speed when died

            if (!oneTimeReset)
            {
                oneTimeReset = true;
                playerAnimator.SetTrigger("Dead");                 //for player dead animation
                Invoke("ResetMoveDirection", 0.7f);
            }
            break;
        }
    }