Ejemplo n.º 1
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;
        }
    }
Ejemplo n.º 2
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);
    }
Ejemplo n.º 3
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));
    }
Ejemplo n.º 4
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);
    }
Ejemplo n.º 6
0
    private IEnumerator StartSFXDelayed(string name, float duration)
    {
        yield return(new WaitForSeconds(duration));

        EffectsHelper.SFX(name);
    }
Ejemplo n.º 7
0
 public void OnPointerClick(PointerEventData eventData)
 {
     EffectsHelper.SFX("UI/onButtonClick");
 }
Ejemplo n.º 8
0
 public void OnPointerExit(PointerEventData eventData)
 {
     EffectsHelper.SFX("UI/onButtonExit");
     transform.DOScale(1, 0.5f);
 }