Inheritance: MonoBehaviour
Example #1
0
	public void Play( FX tipo )
	{
		switch( tipo )
		{
			case FX.AVANCAR:
				Play( currentFxSet.avancar );
				break;		
			case FX.VOLTAR:
				Play( currentFxSet.voltar );
				break;
			case FX.ERRO:
				Play( currentFxSet.erro );
				break;
			case FX.VITORIA:
				Play( currentFxSet.vitoria );
				break;
			case FX.DERROTA:
				Play( currentFxSet.derrotas );
				break;
			default :
				Play(currentFxSet.avancar);
				break;
		}
		
		
	}
Example #2
0
    // fonction appelée lorsqu'un boulet de canon explose
    public void Explode(Vector3 position)
    {
        Vector3 dist;

        for(int i = 0; i < projectilePoolActive.Count; i++)
        {
            go = (GameObject) projectilePoolActive[i];

            dist = go.transform.position - position;

            if(dist.magnitude < 999){/*...*/}
        }

        if(fxPoolReady.Count > 0)
        {
            go = (GameObject) fxPoolReady[0];
            go.transform.position = position;
            go.SetActive(true);

            fx = go.GetComponent(typeof(FX)) as FX;
            fx.Trigger();

            ps = go.GetComponent(typeof(ParticleSystem)) as ParticleSystem;
            ps.Play();

            fxPoolReady.RemoveAt(0);
            fxPoolActive.Add(go);
        }
        print("<explode>");
    }
Example #3
0
 public Attack(Attack from)
 {
     Name        = from.Name;
     AttackInfo  = new AttackInfo(from.AttackInfo);
     TargetBuffs = from.TargetBuffs;
     Attacker    = from.Attacker;
     _fx         = from._fx;
 }
Example #4
0
 public static void Clear()
 {
     foreach (var fx in FX)
     {
         fx.Stop();
     }
     FX.Clear();
 }
Example #5
0
        private String GenerarX()
        {
            String cadena = "";
            FX     para   = (FX)Valor;

            cadena += para.Generar3D();
            return(cadena);
        }
Example #6
0
    void PlayFXFromPool(FXPool pool, Vector3 _position, Transform _parent)
    {
        FX playedFX = pool.Depool();

        playedFX.transform.position = _position;
        playedFX.Play();
        playedFX.transform.parent = _parent;
    }
Example #7
0
    public FX PlayFX(FX_Type fx_Type, Vector3 from)
    {
        FX fx = GameObjectPoolManager.Instance.FXDict[fx_Type].AllocateGameObject <FX>(transform);

        fx.transform.position = from;
        fx.Play();
        return(fx);
    }
Example #8
0
 public static void Clear()
 {
     foreach (VFXBase fx in FX)
     {
         fx.Stop();
     }
     FX.Clear();
 }
        public static HttpContent ToContentUsingXmlSerializer(this object instance)
        {
            FX.ThrowIfNull(instance, "instance");

            var serializer = new XmlSerializer(instance.GetType());

            return(ToContentUsingXmlSerializer(instance, serializer));
        }
 public void DestroyAll()
 {
     UI.DestroyAllAsset();
     Image.DestroyAllAsset();
     Character.DestroyAllAsset();
     Trigger.DestroyAllAsset();
     FX.DestroyAllAsset();
 }
        public static HttpContent ToContentUsingDataContractJsonSerializer(this object instance, params Type[] knownTypes)
        {
            FX.ThrowIfNull(instance, "instance");

            var serializer = new DataContractJsonSerializer(instance.GetType(), knownTypes);

            return(ToContentUsingDataContractJsonSerializer(instance, serializer));
        }
Example #12
0
 void InitialStatus()
 {
     tmr = 0f;
     if (fx == null)
     {
         fx = GetComponent <FX>();
     }
     fx.PlayRandomClip();
 }
Example #13
0
    public void Play(FX fx, Vector3 position, Quaternion rotation)
    {
        var instance = Instantiate(FX[(int)fx]) as GameObject;

        instance.transform.parent        = transform.parent;
        instance.transform.localPosition = position;
        instance.transform.localRotation = rotation;
        instance.SetActive(true);
    }
Example #14
0
    public void Play(FX fx, Transform target)
    {
        var instance = Instantiate(FX[(int)fx]) as GameObject;

        instance.transform.parent        = target;
        instance.transform.localPosition = Vector3.zero;
        instance.transform.localRotation = Quaternion.identity;
        instance.SetActive(true);
    }
Example #15
0
 public DisplacementMapEffect(Device device, string filename) : base(device, filename)
 {
     _heightScale     = FX.GetVariableByName("gHeightScale").AsScalar();
     _maxTessDistance = FX.GetVariableByName("gMaxTessDistance").AsScalar();
     _minTessDistance = FX.GetVariableByName("gMinTessDistance").AsScalar();
     _minTessFactor   = FX.GetVariableByName("gMinTessFactor").AsScalar();
     _maxTessFactor   = FX.GetVariableByName("gMaxTessFactor").AsScalar();
     _viewProj        = FX.GetVariableByName("gViewProj").AsMatrix();
 }
        public override void Begin(int pass, FX fx = FX.DoNotSaveSamplerState | FX.DoNotSaveShaderState | FX.DoNotSaveState)
        {
            if (m_multimaterial)
            {
                base.ApplyMultimaterial();
            }

            base.Begin(pass, fx);
        }
Example #17
0
 public void FillPool()
 {
     for (int i = 0; i < data.poolingAmount; i++)
     {
         FX newFX = Instantiate(data.fx, transform).GetComponent <FX>();
         newFX.pool = this;
         Pool(newFX);
     }
 }
Example #18
0
        public TerrainEffect(Device device, string filename) : base(device, filename)
        {
            Light1Tech    = FX.GetTechniqueByName("Light1");
            Light2Tech    = FX.GetTechniqueByName("Light2");
            Light3Tech    = FX.GetTechniqueByName("Light3");
            Light1FogTech = FX.GetTechniqueByName("Light1Fog");
            Light2FogTech = FX.GetTechniqueByName("Light2Fog");
            Light3FogTech = FX.GetTechniqueByName("Light3Fog");

            Light1ShadowTech    = FX.GetTechniqueByName("Light1Shadow");
            Light2ShadowTech    = FX.GetTechniqueByName("Light2Shadow");
            Light3ShadowTech    = FX.GetTechniqueByName("Light3Shadow");
            Light1FogShadowTech = FX.GetTechniqueByName("Light1FogShadow");
            Light2FogShadowTech = FX.GetTechniqueByName("Light2FogShadow");
            Light3FogShadowTech = FX.GetTechniqueByName("Light3FogShadow");

            Light1TechNT    = FX.GetTechniqueByName("Light1NT");
            Light2TechNT    = FX.GetTechniqueByName("Light2NT");
            Light3TechNT    = FX.GetTechniqueByName("Light3NT");
            Light1FogTechNT = FX.GetTechniqueByName("Light1FogNT");
            Light2FogTechNT = FX.GetTechniqueByName("Light2FogNT");
            Light3FogTechNT = FX.GetTechniqueByName("Light3FogNT");

            NormalDepthTech        = FX.GetTechniqueByName("NormalDepth");
            TessBuildShadowMapTech = FX.GetTechniqueByName("TessBuildShadowMapTech");

            _viewProj = FX.GetVariableByName("gViewProj").AsMatrix();
            _eyePosW  = FX.GetVariableByName("gEyePosW").AsVector();

            _fogColor = FX.GetVariableByName("gFogColor").AsVector();
            _fogStart = FX.GetVariableByName("gFogStart").AsScalar();
            _fogRange = FX.GetVariableByName("gFogRange").AsScalar();

            _dirLights = FX.GetVariableByName("gDirLights");
            _mat       = FX.GetVariableByName("gMaterial");

            _minDist            = FX.GetVariableByName("gMinDist").AsScalar();
            _maxDist            = FX.GetVariableByName("gMaxDist").AsScalar();
            _minTess            = FX.GetVariableByName("gMinTess").AsScalar();
            _maxTess            = FX.GetVariableByName("gMaxTess").AsScalar();
            _texelCellSpaceU    = FX.GetVariableByName("gTexelCellSpaceU").AsScalar();
            _texelCellSpaceV    = FX.GetVariableByName("gTexelCellSpaceV").AsScalar();
            _worldCellSpace     = FX.GetVariableByName("gWorldCellSpace").AsScalar();
            _worldFrustumPlanes = FX.GetVariableByName("gWorldFrustumPlanes").AsVector();

            _layerMapArray = FX.GetVariableByName("gLayerMapArray").AsResource();
            _blendMap      = FX.GetVariableByName("gBlendMap").AsResource();
            _heightMap     = FX.GetVariableByName("gHeightMap").AsResource();

            _view            = FX.GetVariableByName("gView").AsMatrix();
            _ambientMap      = FX.GetVariableByName("gSsaoMap").AsResource();
            _viewProjTex     = FX.GetVariableByName("gViewProjTex").AsMatrix();
            _shadowTransform = FX.GetVariableByName("gShadowTransform").AsMatrix();
            _shadowMap       = FX.GetVariableByName("gShadowMap").AsResource();
            _walkMap         = FX.GetVariableByName("gWalkMap").AsResource();
            _unwalkableSRV   = FX.GetVariableByName("gUnwalkable").AsResource();
        }
Example #19
0
 public void Dispose()
 {
     FX.Dispose();
     foreach (var vGeo in geos)
     {
         vGeo.Dispose();
     }
     VoxelMap.Dispose();
 }
        public static XElement ReadAsXElement(this HttpContent content)
        {
            FX.ThrowIfNull(content, "content");

            using (var reader = XmlReaderContentExtensions.ReadAsXmlReader(content))
            {
                var e = XElement.Load(reader);
                return(e);
            }
        }
        public static object ReadAsJsonDataContract(this HttpContent content, DataContractJsonSerializer serializer)
        {
            FX.ThrowIfNull(content, "content");
            FX.ThrowIfNull(serializer, "serializer");

            using (var r = content.ContentReadStream)
            {
                return(serializer.ReadObject(r));
            }
        }
        public static T ReadAsDataContract <T>(this HttpContent content, DataContractSerializer serializer)
        {
            FX.ThrowIfNull(content, "content");
            FX.ThrowIfNull(content, "serializer");

            using (var stream = content.ContentReadStream)
            {
                return((T)serializer.ReadObject(stream));
            }
        }
        public static object ReadAsXmlSerializable(this HttpContent content, XmlSerializer serializer)
        {
            FX.ThrowIfNull(content, "content");
            FX.ThrowIfNull(serializer, "serialzer");

            using (var r = content.ReadAsXmlReader())
            {
                return(serializer.Deserialize(r));
            }
        }
Example #24
0
    public void PlayHitEffect(Vector3 position, Vector3 direction)
    {
        FX fx = FXManager.Instance.PlayFX(HitFXName, position);

        if (fx)
        {
            fx.transform.localScale = Vector3.one * Scale;
            fx.transform.LookAt(position + direction);
        }
    }
Example #25
0
        public static double FindZero(FX f)
        {
            double x, xnext = 0;

            do
            {
                x     = xnext;
                xnext = x - f(x) / ((f(x + DELTA) - f(x)) / DELTA);
            } while (Math.Abs(xnext - x) > DELTA);
            return(xnext);
        }
Example #26
0
    public FX Depool()
    {
        if (pool.Count < 1)
        {
            FillPool();
        }
        FX depooledFX = pool.Dequeue();

        depooledFX.gameObject.SetActive(true);
        return(depooledFX);
    }
Example #27
0
        public ExtendedNormalMapEffect(Device device, string filename)
            : base(device, filename)
        {
            TweenFactor0 = FX.GetVariableByName("gTweenFactor0").AsScalar();

            MorphTech = FX.GetTechniqueByName("MorphTech");
            SelectedSubmeshMorphTech = FX.GetTechniqueByName("SelectedSubmeshMorphTech");
            NormalsTech         = FX.GetTechniqueByName("NormalsTech");
            BonesTech           = FX.GetTechniqueByName("BonesTech");
            SelectedSubmeshTech = FX.GetTechniqueByName("SelectedSubmeshTech");
        }
Example #28
0
    public override void Kill()
    {
        cell.occupant = 0;
        cell.enemy    = null;
        Game.RemoveEnemy(this);

        anim.PlayAnimation("Warlock_Death");
        FX.Emit(transform.localPosition + Game.HALF_Y, Quaternion.identity, FX.VFX.Bats, 15);

        StartCoroutine(DelayedDestruction(anim.GetClipLength("Warlock_Death")));
    }
        public SsaoNormalDepthEffect(Device device, string filename) : base(device, filename)
        {
            NormalDepthTech          = FX.GetTechniqueByName("NormalDepth");
            NormalDepthAlphaClipTech = FX.GetTechniqueByName("NormalDepthAlphaClip");

            _worldView             = FX.GetVariableByName("gWorldView").AsMatrix();
            _worldInvTransposeView = FX.GetVariableByName("gWorldInvTransposeView").AsMatrix();
            _worldViewProj         = FX.GetVariableByName("gWorldViewProj").AsMatrix();
            _texTransform          = FX.GetVariableByName("gTexTransform").AsMatrix();
            _diffuseMap            = FX.GetVariableByName("gDiffuseMap").AsResource();
        }
        public SsaoBlurEffect(Device device, string filename) : base(device, filename)
        {
            HorzBlurTech = FX.GetTechniqueByName("HorzBlur");
            VertBlurTech = FX.GetTechniqueByName("VertBlur");

            _texelWidth  = FX.GetVariableByName("gTexelWidth").AsScalar();
            _texelHeight = FX.GetVariableByName("gTexelHeight").AsScalar();

            _normalDepthMap = FX.GetVariableByName("gNormalDepthMap").AsResource();
            _inputImage     = FX.GetVariableByName("gInputImage").AsResource();
        }
Example #31
0
 public WavesEffect(Device device, string filename) : base(device, filename)
 {
     _waveDispTexTransform0   = FX.GetVariableByName("gWaveDispTexTransform0").AsMatrix();
     _waveDispTexTransform1   = FX.GetVariableByName("gWaveDispTexTransform1").AsMatrix();
     _waveNormalTexTransform0 = FX.GetVariableByName("gWaveNormalTexTransform0").AsMatrix();
     _waveNormalTexTransform1 = FX.GetVariableByName("gWaveNormalTexTransform1").AsMatrix();
     _heightScale0            = FX.GetVariableByName("gHeightScale0").AsScalar();
     _heightScale1            = FX.GetVariableByName("gHeightScale1").AsScalar();
     _normalMap0 = FX.GetVariableByName("gNormalMap0").AsResource();
     _normalMap1 = FX.GetVariableByName("gNormalMap1").AsResource();
 }
Example #32
0
    public FX GetFX(GameObject target, FX.Types type)
    {
        foreach (FX fx in this.fxs)
        {
            if (fx.Target == target &&
                fx.Type == type)
                return fx;
        }

        return null;
    }
Example #33
0
        public DebugTexEffect(Device device, string filename) : base(device, filename)
        {
            ViewArgbTech  = FX.GetTechniqueByName("ViewArgbTech");
            ViewRedTech   = FX.GetTechniqueByName("ViewRedTech");
            ViewGreenTech = FX.GetTechniqueByName("ViewGreenTech");
            ViewBlueTech  = FX.GetTechniqueByName("ViewBlueTech");
            ViewAlphaTech = FX.GetTechniqueByName("ViewAlphaTech");

            _texture = FX.GetVariableByName("gTexture").AsResource();
            _wvp     = FX.GetVariableByName("gWorldViewProj").AsMatrix();
        }
Example #34
0
	void Start () 
	{
		currentWorld = spawnWorld;
		this.transform.position = currentWorld.transform.position;
		rayDirection = new Vector3(Input.mousePosition.x, Input.mousePosition.y);

		ui = GetComponent<Interface>();
		fx = GameObject.FindObjectOfType<FX>();
		
		transition = GameObject.FindObjectOfType<Transition>();
		mouseLook = GameObject.FindObjectOfType<MouseLook>();
	}
Example #35
0
 /// <summary>
 /// This function tells the FX manager to recycle a non-active (Dead) FX object,
 /// depending on its type
 /// </summary>
 /// <param name="type">The type of the FX object to recycle</param>
 /// <param name="position">The location of the FX object</param>
 /// <param name="direction">The direction the FX object should face (1 = same as the animation, -1 = mirror along the x axis of the animation)</param>
 /// <param name="value">The value to assign to the FX object</param>
 public void Activate(FX.FX_TYPE type, Vector3 position, int direction, string value)
 {
     // check each FX object in the internal list
     foreach (FX fx in _fxList)
     {
         // if the FX object is dead and is of the type we are looking for then recycle it
         if (fx.State == FX.STATE.Dead && fx.fxType == type)
         {
             // reset the FX object, bringing it back to life
             fx.Reset(position, direction, value);
             break;
         }
     }
 }
Example #36
0
    private void FXVerification(GameObject target, FX.Types type)
    {
        foreach (FX fx in this.fxs)
        {
            if (fx.Target == target &&
                fx.Type == type)
            {
                fx.ForcedDestroy();

                this.fxs.Remove(fx);

                break;
            }
        }
    }
Example #37
0
	void Start () 
	{
		currentWorld = spawnWorld;
		this.transform.position = currentWorld.transform.position;
		rayDirection = new Vector3(0.5f, 0.5f, 1f);

		ui = GetComponent<Interface>();
		fx = GameObject.FindObjectOfType<FX>();
		voice = GameObject.FindObjectOfType<Voice>();
		
		transition = GameObject.FindObjectOfType<Transition>();
		mouseLook = GameObject.FindObjectOfType<MouseLook>();
		audioListener = GameObject.FindObjectOfType<AudioListener>().transform;

		StartCoroutine(transition.Intro(gateSpawn));
	}
Example #38
0
	public IEnumerator Intro (Gate gateSpawn) 
	{
		// Start

		fx = GameObject.FindObjectOfType<FX>();
		voice = GameObject.FindObjectOfType<Voice>();

		voice.Cough();
		yield return new WaitForSeconds(1f);
		
		fx.Match();
		yield return new WaitForSeconds(3f);

		// Update

		float timeElapsed = 0f;
		float timeRatio = 0f;
		float duration = 2f;
		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialTitle.SetFloat("_Alpha", timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}

		yield return new WaitForSeconds(1f);

		timeElapsed = 0f;

		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialTitle.SetFloat("_Alpha", 1f - timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}

		fx.BookFall();

		yield return new WaitForSeconds(1f);

		StartCoroutine(Goto(gateSpawn));

		player.started = true;
	}
        public override void Begin(int pass, FX fx)
        {       /*
            if (UseChannels && m_maskTexture != null)
            {
                SetTechnique(MyRenderConstants.RenderQualityProfile.ModelsChannelsTechnique);
            }
            else  */
            //{
                //SetTechnique(MyRenderConstants.RenderQualityProfile.ModelsRenderTechnique);
            //}

                base.Begin(pass);
        }
        public override void Begin(int pass, FX fx)
        {       /*
            if (UseChannels && m_maskTexture != null)
            {
                SetTechnique(MyRenderConstants.RenderQualityProfile.ModelsChannelsTechnique);
            }
            else  */
            //{
            //SetTechnique(MyRenderConstants.RenderQualityProfile.ModelsRenderTechnique);
            //}

            VRageRender.Graphics.SamplerState.LinearWrap.Apply();

            base.Begin(pass, fx);
        }
 Product GetProduct(string[] items)
 {
     var prodType = items[secTypeCol];
     var unknown = false;
     Product prod = null;
     if (prodType.EndsWith("F") || prodType.EndsWith("O"))
         prod = Env.Current.Trade.GetProductByCode(Product.RtDefaultTicker, items[rSymbolCol]) ??
             Env.Current.Trade.GetProductByCode(TradeImportHelper.ImagineMaturity, items[rSymbolCol]) ??
             FindFuture(items);
     else if (prodType.Equals("S"))
         prod = Env.Current.Trade.GetProductByCode(Product.CusipProductCode, items[cusipCol]) ??
             Env.Current.Trade.GetProductByCode(Product.IsinProductCode, items[isinCol]) ??
             Env.Current.Trade.GetProductByCode(Product.SedolProductCode, items[sedolCol]);
     else if (prodType.Equals("CUR"))
     {
         var fx = new FX();
         var sec = items[rSymbolCol];
         if (sec.Length == 6)
         {
             fx.Primary = sec.Substring(0, 3);
             fx.Quoting = sec.Substring(3);
             fx.PrimaryAmount = double.Parse(items[quantityCol]);
             fx.QuotingAmount = double.Parse(items[notionalCol]);
             fx.SpotRate = double.Parse(items[costCol]);
             prod = fx;
         }
     }
     else
         unknown = true;
     if (prod == null)
     {
         var gproduct = new GenericProduct
         {
             ProductProcessingType = prodType,
             ProductPricingType = prodType,
             ProductDescription = unknown ? TypeUnknown : items[descCol],
             ProductCategory = prodType,
         };
         prod = gproduct;                
     }
     return prod;
 }
Example #42
0
    // fonction de réinitialisation
    public override void Reset()
    {
        print("<canon init>");

        poolSize = 10;

        frequency = 0.35f;

        force = 10.0f;

        projectilePoolReady  = new List<GameObject>();
        projectilePoolActive = new List<GameObject>();

        for(int i = 0; i < poolSize; i++)
        {
            go = factory.CreateProjectile(Projectile.ProjectileType.PROJECTILE_CANNON);
            goRigidBody = go.GetComponent(typeof(Rigidbody)) as Rigidbody;

            go.transform.parent = pool.transform;

            go.transform.Translate(0, 0, i * -3.5f, Space.Self);

            goRigidBody.isKinematic = true;

            projectilePoolReady.Add(go);
        }

        fxPoolReady  = new List<GameObject>();
        fxPoolActive = new List<GameObject>();

        for(int i = 0; i < poolSize / 2; i++)
        {
            go = factory.CreateFX(Projectile.ProjectileType.PROJECTILE_CANNON);

            go.transform.parent = pool.transform;

            go.transform.Translate(0, 0, i * -3.5f, Space.Self);

            go.SetActive(false);

            fx = go.GetComponent(typeof(FX)) as FX;
            fx.Reset();

            fxPoolReady.Add(go);
        }
    }
 public override void Begin(int pass, FX fx)
 {
     base.Begin(pass, FX.DoNotSaveState | FX.DoNotSaveShaderState | FX.DoNotSaveSamplerState);
 }
        public override void Begin(int pass = 0, FX fx = FX.DoNotSaveSamplerState | FX.DoNotSaveShaderState | FX.DoNotSaveState)
        {
            if (MyRenderConstants.RenderQualityProfile.ForwardRender)
                SetTechnique(MyEffectCockpitGlassTechniqueEnum.Forward);
            else
                SetTechnique(MyEffectCockpitGlassTechniqueEnum.Default);

            base.Begin(pass);
        }
 public virtual void Begin(int pass = 0, FX fx = FX.None)
 {
     System.Diagnostics.Debug.Assert(begin == false);
     m_D3DEffect.Begin(fx);
     m_D3DEffect.BeginPass(pass);
     begin = true;
 }
Example #46
0
    // fonction de mise à jour
    public void FixedUpdate()
    {
        for(int i = 0; i < projectilePoolActive.Count; i++)
        {
            go = (GameObject) projectilePoolActive[i];
            goRigidBody = go.GetComponent(typeof(Rigidbody)) as Rigidbody;

            bullet = go.GetComponent(typeof(ProjectileCannon)) as ProjectileCannon;

            if(bullet.isActive)
            {
                if(Time.time - bullet.timeShoot > bullet.timeLife)
                {
                    bullet.isExpired = true;
                }
                if(bullet.isExpired)
                {
                    bullet.isActive = false;

                    explosionPosition = go.transform.position;

                    goRigidBody.isKinematic = true;
                    go.transform.transform.position = nowhere;

                    projectilePoolActive.RemoveAt(i);
                    projectilePoolReady.Add(go);

                    Explode(explosionPosition);
                }
                if(bullet.hasCollided){/*...*/}
                if(bullet.hasExploded){/*...*/}
            }
        }
        for(int i = 0; i < fxPoolActive.Count; i++)
        {
            go = (GameObject) fxPoolActive[i];

            fx = go.GetComponent(typeof(FX)) as FX;

            if(fx.isActive)
            {
                if(Time.time - fx.timeShoot > fx.timeLife)
                {
                    fx.isExpired = true;
                }

                if(fx.isExpired)
                {
                    fx.isActive = false;

                    explosionPosition = nowhere;

                    go.transform.transform.position = explosionPosition;

                    ps = go.GetComponent(typeof(ParticleSystem)) as ParticleSystem;
                    ps.Stop();

                    go.SetActive(false);

                    fxPoolActive.RemoveAt(i);
                    fxPoolReady.Add(go);
                }
            }
        }
    }
Example #47
0
	public IEnumerator Thanks () 
	{
		fx = GameObject.FindObjectOfType<FX>();
		fx.PageTake();

		// Update

		float timeElapsed = 0f;
		float timeRatio = 0f;
		float duration = 2f;
		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialThanks.SetFloat("_Alpha", timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}

		yield return new WaitForSeconds(5f);

		timeElapsed = 0f;

		while (timeElapsed < duration) {
			timeRatio = timeElapsed / duration;
			materialThanks.SetFloat("_Alpha", 1f - timeRatio);
			timeElapsed += Time.deltaTime;
			yield return 0;
		}
	}
        public override void Begin(int pass = 0, FX fx = FX.DoNotSaveSamplerState | FX.DoNotSaveShaderState | FX.DoNotSaveState)
        {
            SetTechnique();

            base.Begin(pass);
        }
Example #49
0
 /// <summary>
 /// This function is called from the FX object, notifying the manager that
 /// the object needs to be deactivated.
 /// Note that this does not destroy the object, merely turns it "off" for 
 /// reuse later.
 /// </summary>
 /// <param name="fx">The FX object to deactivate</param>
 public void KillFX(FX fx)
 {
     // set the state of the FX object to Dead
     fx.State = FX.STATE.Dead;
 }
 public override void Begin(int pass, FX fx)
 {  
     VRageRender.Graphics.SamplerState.LinearWrap.Apply();
     base.Begin(pass, fx);
 }
        private Product GetProduct(SymmetryInfo info)
        {


            if (info.SecurityType.ToLowerInvariant() == "bonds")
            {
                var pr = Env.Current.Trade.GetProductByDescription(info.Security);
                if (pr != null) return pr;
                if (!Utilities.IsNullOrEmpty(info.Cusip))
                {
                    pr = Env.Current.Trade.GetProductByCode(Product.CusipProductCode, info.Cusip);
                    if (pr != null) return pr;
                }
                var ccys = new List<string> { info.Currency };
                var allBonds = Env.Current.Trade.LoadBondProducts(null, null, null, 0, ccys, -1, info.Coupon,
                                                                  info.Coupon, null, null, SimpleDate.Today, false,
                                                                  false, null, null);
                if (allBonds != null)
                {
                    foreach (var v in allBonds)
                    {
                        var bd = v as Bond;
                        if (bd == null) continue;
                        if (Math.Abs(bd.FixedRate - info.Coupon) < Utilities.Epsilon && bd.MaturityDate == info.Maturity)
                        {
                           if (!StatusDisabled.Equals(bd.Status)) return bd;
                        }
                    }
                }

                throw new Exception("Bonds " + info.Security + " not retrieved");
            }
            if (info.SecurityType.ToLower() == "currency")
            {
                return null;
            }
            if (info.SecurityType == "Caps/Floors")
            {

            }
            if (info.SecurityType.ToLower() == "currency swaps")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "interest rate swaps")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "swaptions")
            {
                return null;
            }
            if (info.SecurityType.ToLower() == "fras")
            {
                return null;
            }
            //Fx Vol Swap
            if (info.SecurityType.ToLower() == "flexible deal" && info.Security.Contains("VOLSWAP"))
            {
                //GBP/USD VOLSWAP 5.925 04 Dec 2014 (02 Sep 2014-02 Dec 2014)
                //USD/JPY VOLSWAP 8.05 17 Nov 2014 (12 Sep 2014-13 Nov 2014)
                var volswap = new VolSwap();
                var desc = info.Security.Split(' ');
                var cpl = desc[0].Split('/');
                var cp = Env.Current.Trade.GetCurrencyPair(cpl[0], cpl[1]);
                volswap.Underlier = cp;
                volswap.UnderlierId = cp.Id;
                volswap.EndDate = info.Maturity;
                volswap.Notional = Math.Abs(info.CurrentDayPosition/100);
                volswap.IsBuy = info.CurrentDayPosition > 0;
                volswap.PaymentCurrency = info.Currency;
                if (desc.Length > 2)
                {
                    double strike;
                    if (double.TryParse(desc[2], out strike))
                        volswap.Strike = strike;
                }
                return volswap;
            }
            //FX Option
            if (info.SecurityType.ToLower() == "simple option" || info.SecurityType.ToLower() == "simple barrier"
                || info.SecurityType.ToLower() == "touch rebate" || info.SecurityType.ToLower() == "flexible deal"
                || info.SecurityType.ToLower() == "double barrier")
            {
                // EUR/USD 1.3204 CALL (26 Nov 2014)
                var fxoption = info.SecurityType.ToLower() == "flexible deal" ?
                    new FxFva { FvaExpiryDate = info.Maturity } : new FXOption { ExpiryDate = info.Maturity };
                var desc = info.Security.Split(' ');
                var cpl = desc[0].Split('/');
                fxoption.Primary = cpl[0];
                fxoption.Quoting = cpl[1];
                if (!(fxoption is FxFva))
                    fxoption.OptionStrike = Convert.ToDouble(desc[1], CultureInfo.InvariantCulture);
                fxoption.PrimaryAmount = Math.Abs(info.CurrentDayPosition);
                fxoption.QuotingAmount = fxoption.PrimaryAmount * fxoption.OptionStrike;
                if (info.Security.Contains("CALL ")) fxoption.OptionType = OptionType.Call;
                else if (info.Security.Contains("PUT ")) fxoption.OptionType = OptionType.Put;
                else fxoption.OptionType = OptionType.None;
                if (info.CurrentDayPosition > 0)
                {
                    fxoption.IsBuy = true;
                    fxoption.QuotingAmount = -fxoption.QuotingAmount;
                }
                else
                {
                    fxoption.IsBuy = false;
                    fxoption.PrimaryAmount = -fxoption.PrimaryAmount;
                }
                fxoption.ExerciseType = OptionExerciseType.European;

                if (info.SecurityType.ToLower() == "flexible deal")
                {
                    // EUR/USD FVA 0 25 Feb 2015 (21 Nov 2014-23 Feb 2015)
                    var fva = fxoption as FxFva;
                    if (fva != null)
                        fva.Volatility = Convert.ToDouble(desc[2], CultureInfo.InvariantCulture) / 100;
                }
                else if (info.SecurityType.ToLower() == "simple barrier")
                {
                    // USD/CNY 6.16 PUT 16 Dec 2014 DO 6.07
                    // USD/SGD 1.265 CALL 24 Sep 2014 UI 1.2725
                    fxoption.ExerciseType = OptionExerciseType.Barrier;
                    var binfo = new BarrierInfo();
                    fxoption.OptionInfo = binfo;
                    var len = desc.Length;
                    var barrierType = desc[len - 2];
                    var barrierStrike = desc[len - 1];
                    if (barrierType.StartsWith("D"))
                    {
                        if (barrierType.EndsWith("I"))
                            binfo.LowerBarrierType = OptionBarrierType.KnockIn;
                        else
                            binfo.LowerBarrierType = OptionBarrierType.KnockOut;
                        binfo.LowerBarrierStrike = double.Parse(barrierStrike);
                    }
                    else
                    {
                        if (barrierType.EndsWith("I"))
                            binfo.BarrierType = OptionBarrierType.KnockIn;
                        else
                            binfo.BarrierType = OptionBarrierType.KnockOut;
                        binfo.BarrierStrike = double.Parse(barrierStrike);
                    }

                }
                else if (info.SecurityType.ToLower() == "double barrier")
                {
                    // USD/JPY 105 CALL 18 Dec 2014 KO 108 101
                    fxoption.ExerciseType = OptionExerciseType.Barrier;
                    var binfo = new BarrierInfo();
                    fxoption.OptionInfo = binfo;
                    var len = desc.Length;
                    var barrierType = desc[len - 3];
                    var barrierStrike1 = desc[len - 1];
                    var barrierStrike2 = desc[len - 2];
                    if (barrierType.Equals("KO"))
                    {
                        binfo.BarrierType = OptionBarrierType.KnockIn;
                        binfo.LowerBarrierType = OptionBarrierType.KnockIn;
                    }
                    else
                    {
                        binfo.BarrierType = OptionBarrierType.KnockOut;
                        binfo.LowerBarrierType = OptionBarrierType.KnockOut;
                    }
                    double strike1, strike2;
                    if (double.TryParse(barrierStrike1, out strike1))
                        binfo.BarrierStrike = strike1;
                    if (double.TryParse(barrierStrike2, out strike2))
                        binfo.LowerBarrierStrike = strike2;
                    if (binfo.BarrierStrike < binfo.LowerBarrierStrike)
                    {
                        var temp = binfo.BarrierStrike;
                        binfo.BarrierStrike = binfo.LowerBarrierStrike;
                        binfo.LowerBarrierStrike = temp;
                    }
                }
                else if (info.SecurityType.ToLower() == "touch rebate")
                {
                    // USD/MXN 13.45  10 Sep 2014 UO 13.45
                    // USD/CAD 1.105  12 Sep 2014 KI 1.105 1.082
                    // GBP/USD 1.59  04 Nov 2014 DO 1.59
                    // for touch, please only compare strikes
                    fxoption.ExerciseType = OptionExerciseType.Touch;
                    var tinfo = new DigitalInfo();
                    fxoption.OptionInfo = tinfo;
                    var len = desc.Length;
                    double strike1, strike2;
                    if (double.TryParse(desc[len - 2], out strike1))
                        tinfo.BarrierStrike = strike1;
                    if (double.TryParse(desc[len - 1], out strike2))
                        tinfo.LowerBarrierStrike = strike2;
                    if (tinfo.BarrierStrike < tinfo.LowerBarrierStrike)
                    {
                        var temp = tinfo.BarrierStrike;
                        tinfo.BarrierStrike = tinfo.LowerBarrierStrike;
                        tinfo.LowerBarrierStrike = temp;
                    }
                }
                return fxoption;
            }
            if (info.SecurityType.ToLower().Contains("futures") || info.SecurityType.ToLower().Contains("future options"))
            {
                var pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim());
                if (pr != null) return pr;
                if (!info.SecurityType.ToLower().Equals("equity futures"))
                    pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Comdty");
                if (pr != null) return pr;
                if (!info.SecurityType.ToLower().Equals("equity futures"))
                    pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Curncy");
                if (pr != null) return pr;
                pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Index");
                if (pr != null) return pr;
                pr = Env.Current.Trade.GetProductByCode(Product.DefaultTicker, info.Security.Trim() + " Equity");
                if (pr != null) return pr;
                throw new Exception("Futures " + info.SecurityType + " " + info.Security + " not retrieved");
            }


            if (info.SecurityType.ToLower() == "spot-forward")
            {
                var fx = new FX();
                var splits = info.Security.Substring(0, 7).Split('/');
                string ccy1 = splits[0];
                string ccy2 = splits[1];
                var cp = Env.Current.Trade.GetCurrencyPair(ccy1, ccy2);
                if (cp == null) return null;
                fx.Primary = cp.Primary;
                fx.Quoting = cp.Quoting;
                var settleDate = info.Maturity;
                fx.PrimarySettleDate = settleDate;
                fx.QuotingSettleDate = settleDate;

                /*
                var ccy2Obj = Env.Current.StaticData.GetCurrency(ccy2);
                if (ccy2Obj != null && ccy2Obj.IsNonDeliverable)
                {
                    var ndf = new NDF
                        {
                            Primary = cp.Primary,
                            Quoting = cp.Quoting,
                            PrimarySettleDate = settleDate,
                            QuotingSettleDate = settleDate
                        };
                    return ndf;
                }*/

                return fx;

            }
            throw new Exception("Reconciliation not supported for Product" + info.SecurityType.ToLower());
        }
 public override void Begin(int pass = 0, FX fx = FX.DoNotSaveSamplerState | FX.DoNotSaveShaderState | FX.DoNotSaveState)
 {
     m_D3DEffect.SetValue(m_worldViewMatrix, m_world * m_view);
     m_D3DEffect.SetValue(m_worldViewProjectionMatrix, m_world * m_view * m_projection);
     base.Begin(pass);
 }