Esempio n. 1
0
    protected override IEnumerator EffectLogic()
    {
        TargetedMeleeAbility meleeAbility = GetComponent <TargetedMeleeAbility>();

        if (meleeAbility != null)
        {
            GameObject            effectInstance = Instantiate(effectPrefab, EquipmentManager.Instance.GetCurrentWeapon().transform);  //object pooling causes too many bugs and does not offer much performance in this situation
            PSMeshRendererUpdater meshEffect     = effectInstance.GetComponent <PSMeshRendererUpdater>();
            if (EquipmentManager.Instance.GetCurrentWeapon().GetComponentInChildren <Target>())
            {
                meshEffect.UpdateMeshEffect(EquipmentManager.Instance.GetCurrentWeapon().GetComponentInChildren <Target>().gameObject);
            }
            else
            {
                meshEffect.UpdateMeshEffect(EquipmentManager.Instance.GetCurrentWeapon());
            }


            yield return(new WaitForSeconds(duration));

            if (meshEffect != null)
            {
                Destroy(effectInstance);
            }
        }
        else
        {
            Debug.Log("no melee abilities found!");
        }

        RemoveAndDestroy();
    }
Esempio n. 2
0
    private void OnGUI()
    {
        if (Input.GetKeyUp((KeyCode)276) || Input.GetKeyUp((KeyCode)275) || Input.GetKeyUp((KeyCode)274))
        {
            this.isButtonPressed = false;
        }
        if (GUI.Button(new Rect(10f * this.dpiScale, 15f * this.dpiScale, 135f * this.dpiScale, 37f * this.dpiScale), "PREVIOUS EFFECT") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)276))
        {
            this.isButtonPressed = true;
            this.ChangeCurrent(-1);
        }
        if (GUI.Button(new Rect(160f * this.dpiScale, 15f * this.dpiScale, 135f * this.dpiScale, 37f * this.dpiScale), "NEXT EFFECT") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)275))
        {
            this.isButtonPressed = true;
            this.ChangeCurrent(1);
        }
        float num1 = 0.0f;

        if (GUI.Button(new Rect(10f * this.dpiScale, 63f * this.dpiScale + num1, 285f * this.dpiScale, 37f * this.dpiScale), "Day / Night") || !this.isButtonPressed && Input.GetKeyDown((KeyCode)274))
        {
            this.isButtonPressed = true;
            if (Object.op_Inequality((Object)this.ReflectionProbe, (Object)null))
            {
                this.ReflectionProbe.RenderProbe();
            }
            this.Sun.set_intensity(this.isDay ? this.startSunIntensity : 0.05f);
            this.Sun.set_shadows(!this.isDay ? (LightShadows)0 : (LightShadows)(int)this.startLightShadows);
            foreach (Light nightLight in this.NightLights)
            {
                nightLight.set_shadows(this.isDay ? (LightShadows)0 : (LightShadows)(int)this.startLightShadows);
            }
            ((Component)this.Sun).get_transform().set_rotation(!this.isDay ? Quaternion.Euler(350f, 30f, 90f) : this.startSunRotation);
            RenderSettings.set_ambientLight(this.isDay ? this.startAmbientLight : new Color(0.2f, 0.2f, 0.2f));
            float num2 = this.UseMobileVersion ? 0.3f : 1f;
            RenderSettings.set_ambientIntensity(!this.isDay ? num2 : this.startAmbientIntencity);
            RenderSettings.set_reflectionIntensity(!this.isDay ? 0.2f : this.startReflectionIntencity);
            this.isDay = !this.isDay;
        }
        GUI.Label(new Rect(400f * this.dpiScale, (float)(15.0 * (double)this.dpiScale + (double)num1 / 2.0), 100f * this.dpiScale, 20f * this.dpiScale), "Prefab name is \"" + ((Object)this.Prefabs[this.currentNomber]).get_name() + "\"  \r\nHold any mouse button that would move the camera", this.guiStyleHeader);
        GUI.DrawTexture(new Rect(12f * this.dpiScale, 140f * this.dpiScale + num1, 285f * this.dpiScale, 15f * this.dpiScale), this.HUETexture, (ScaleMode)0, false, 0.0f);
        float colorHue = this.colorHUE;

        this.colorHUE = GUI.HorizontalSlider(new Rect(12f * this.dpiScale, 147f * this.dpiScale + num1, 285f * this.dpiScale, 15f * this.dpiScale), this.colorHUE, 0.0f, 360f);
        if ((double)Mathf.Abs(colorHue - this.colorHUE) <= 0.001)
        {
            return;
        }
        PSMeshRendererUpdater componentInChildren1 = (PSMeshRendererUpdater)this.characterInstance.GetComponentInChildren <PSMeshRendererUpdater>();

        if (Object.op_Inequality((Object)componentInChildren1, (Object)null))
        {
            componentInChildren1.UpdateColor(this.colorHUE / 360f);
        }
        PSMeshRendererUpdater componentInChildren2 = (PSMeshRendererUpdater)this.modelInstance.GetComponentInChildren <PSMeshRendererUpdater>();

        if (!Object.op_Inequality((Object)componentInChildren2, (Object)null))
        {
            return;
        }
        componentInChildren2.UpdateColor(this.colorHUE / 360f);
    }