Inheritance: MonoBehaviour
示例#1
0
    public void OnDettached()
    {
        float duration = EffectsHelper.SFX("_DettachModule");

        transform.SetParent(null);

        switch (data.moduleAction)
        {
        case ModuleAction.NONE:
            Debug.Log("Module NONE Dettached");
            break;

        case ModuleAction.OXYGEN:
            Debug.Log("Module OXYGEN Dettached");
            StopCoroutine(oxygenModule);
            oxygenModule = null;
            break;

        case ModuleAction.ENERGY:
            Debug.Log("Module ENERGY Dettached");
            StopCoroutine(energyModule);
            Destroy(lineRenderer.gameObject);
            energyModule = null;
            lineRenderer = null;
            break;
        }

        gameObject.SetActive(false);
    }
示例#2
0
    public void OnAttached(PlayerController player, GameObject slot)
    {
        float duration = EffectsHelper.SFX("_AttachModule");

        transform.SetParent(slot.transform, false);
        transform.localPosition = Vector3.zero;
        transform.localRotation = Quaternion.identity;
        attached = true;

        switch (data.moduleAction)
        {
        case ModuleAction.NONE:
            break;

        case ModuleAction.OXYGEN:
            Debug.Log("Module OXYGEN Attached");
            StartCoroutine(StartSFXDelayed("_OxygenModule", duration / 2));
            oxygenModuleAmount = 10f;
            oxygenModule       = StartCoroutine(OxygenDeployment(player));
            break;

        case ModuleAction.ENERGY:
            Debug.Log("Module ENERGY Attached");
            StartCoroutine(StartSFXDelayed("_EnergyModule", duration / 2));
            if (energyModule == null)
            {
                energyModule = StartCoroutine(EnergyRadar(player));
            }
            break;
        }
    }
    public void DestroyAsteroid()
    {
        EffectsHelper.Particles("AsteroidCrash", transform.position);

        ready = false;
        gameObject.SetActive(false);
        EventManager.TriggerEvent(Statics.Events.asteroidDistroy);
    }
 private void InstantiateGases()
 {
     frontGas01PS = EffectsHelper.GasParticles(frontGas01, "Gas");
     frontGas02PS = EffectsHelper.GasParticles(frontGas02, "Gas");
     frontLeftPS  = EffectsHelper.GasParticles(frontLeft, "Gas");
     frontRightPS = EffectsHelper.GasParticles(frontRight, "Gas");
     backGas01PS  = EffectsHelper.GasParticles(backGas01, "BigSmoke");
     backGas02PS  = EffectsHelper.GasParticles(backGas02, "BigSmoke");
 }
    public void LoadMainMenu(Action callback = null)
    {
        LoadScene("MainMenu", () =>
        {
            menuAudioSource = EffectsHelper.Music("MenuLoop");

            callback?.Invoke();
        });
    }
示例#6
0
    void Awake()
    {
        // регистрация синглтона
        if (Instance != null)
        {
            Debug.LogError("several initiations of EffectsHelper!");
        }

        Instance = this;
    }
示例#7
0
    /// <summary>
    /// Function for losing the game
    /// </summary>
    private void OnGameOver()
    {
        EffectsHelper.SFX("_GameOverExplosion");

        float explosionOffset = 1f;

        EffectsHelper.Particles("ShipExplosion01", player.transform.position);
        EffectsHelper.Particles("ShipExplosion02", player.transform.position + new Vector3(UnityEngine.Random.Range(-explosionOffset, explosionOffset), 0, UnityEngine.Random.Range(-explosionOffset, explosionOffset)));
        EffectsHelper.Particles("ShipExplosion03", player.transform.position + new Vector3(UnityEngine.Random.Range(-explosionOffset, explosionOffset), 0, UnityEngine.Random.Range(-explosionOffset, explosionOffset)));
        EffectsHelper.Particles("ShipExplosion04", player.transform.position + new Vector3(UnityEngine.Random.Range(-explosionOffset, explosionOffset), 0, UnityEngine.Random.Range(-explosionOffset, explosionOffset)));

        StartCoroutine(ShowEndScreen("SHIP DESTROYED!", lostImage));
    }
    public void LoadGame(Action callback = null)
    {
        if (menuAudioSource != null)
        {
            menuAudioSource.Stop();
            menuAudioSource.gameObject.SetActive(false);

            menuAudioSource = null;
        }

        LoadScene("Game", () =>
        {
            gameAudioSource = EffectsHelper.Music("GameMainLoop");

            callback?.Invoke();
        });
    }
示例#9
0
    public void OnTriggerEnter(Collider other)
    {
        if (other.CompareTag("Player"))
        {
            EventManager.TriggerEvent(Statics.Events.moduleHitPlayer, this);
        }
        else if (other.CompareTag("Asteroid") && attached)
        {
            EffectsHelper.SFX("_AsteroidModuleCrash");
            EffectsHelper.Particles("ModuleCrash", transform.position);

            other.GetComponent <Asteroid>().DestroyAsteroid();
            EventManager.TriggerEvent(Statics.Events.moduleHitAsteroid, this);
        }
        else if (other.CompareTag("Base"))
        {
            DestroyModule();
        }
    }
    public void DoDamage(int damageAmount)
    {
        if (GameManager.Instance.godMode)
        {
            return;
        }

        EffectsHelper.SFX("_AsteroidShipCrash");
        EffectsHelper.Particles("ShipCrash", transform.position);

        currentHull -= damageAmount;

        if (currentHull <= 0)
        {
            StopAllGases();
            currentHull = 0;
            EventManager.TriggerEvent(Statics.Events.gameOver);
        }

        EventManager.TriggerEvent(Statics.Events.hullDamaged, currentHull);
    }
示例#11
0
    private IEnumerator StartSFXDelayed(string name, float duration)
    {
        yield return(new WaitForSeconds(duration));

        EffectsHelper.SFX(name);
    }
 private AudioSource StartBackGas(VisualEffect gas1, VisualEffect gas2)
 {
     gas1.Play();
     gas2.Play();
     return(EffectsHelper.SFXLoop("_MotorEspacialLoop"));
 }
 private AudioSource StartFrontGas(VisualEffect gas)
 {
     gas.Play();
     return(EffectsHelper.SFXLoop("_VaporDavantLoop_mig"));
 }
 public void OnPointerClick(PointerEventData eventData)
 {
     EffectsHelper.SFX("UI/onButtonClick");
 }
 public void OnPointerExit(PointerEventData eventData)
 {
     EffectsHelper.SFX("UI/onButtonExit");
     transform.DOScale(1, 0.5f);
 }
 void Awake()
 {
     if(Instance != null)
         Debug.LogError ("EffectsHelper Instance already made!");
     Instance = this;
 }