Ejemplo n.º 1
0
    private void OnKilled()
    {
        m_isAlive       = false;
        m_enableControl = false;
        HealthCurrent   = 0.0f;

        if (crashSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(crashSound);
        }

        m_engineControl.SetEngineActive(false);

        if (destroyedRocketObject != null)
        {
            destroyedRocketObject.SetActive(true);
        }

        if (rocketObject != null)
        {
            rocketObject.SetActive(false);
        }

        WorldControl.GetInstance().ShowMessage("You broke you rocket. Try again.");
        StartCoroutine(RestartCrt());
    }
Ejemplo n.º 2
0
    public void OnButtonEndLevelPressed()
    {
        WorldControl.GetInstance().EndLevel();

        DialogsController.GetInstance().ShowDialog(DialogType.StartMenu);
        SetActive(false);
    }
Ejemplo n.º 3
0
 void Start()
 {
     if (m_engineWorkingSound)
     {
         WorldControl.GetInstance().soundController.SetEngineAudioClip(m_engineWorkingSound);
     }
 }
Ejemplo n.º 4
0
 public override void OnTriggered(RocketControl rocket)
 {
     if (WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound)
     {
         WorldControl.GetInstance().soundController.PlayShortSound(WorldControl.GetInstance().getMap().GetComponent <MapInfo>().m_collectSound);
     }
     Destroy(gameObject);
 }
Ejemplo n.º 5
0
    public void ApplyDamage(float damageAmount)
    {
        HealthCurrent -= damageAmount;
        WorldControl.GetInstance().CallHpChanged(HealthCurrent);

        if (HealthCurrent <= 0)
        {
            OnKilled();
        }
    }
Ejemplo n.º 6
0
    public override void OnTrigerStay(RocketControl rocket)
    {
        if (m_idx == WorldControl.GetInstance().CurrentCheckpoint || m_allowedVelosity < rocket.GetComponent <Rigidbody2D>().velocity.magnitude)
        {
            return;
        }

        WorldControl.GetInstance().OnCheckpointSaved(m_idx);
        WorldControl.GetInstance().ShowMessage("Checkpoint saved!");
    }
Ejemplo n.º 7
0
    public void OnButtonStartPressed()
    {
        if (WorldControl.GetInstance() == null)
        {
            return;
        }

        WorldControl.GetInstance().LoadLevel(m_mapIdx);
        SetActive(false);
    }
Ejemplo n.º 8
0
    public static void Clear()
    {
        PlayerPrefs.DeleteAll();
        Init();
        WorldControl wc = WorldControl.GetInstance();

        if (wc != null)
        {
            wc.Init();
        }
    }
Ejemplo n.º 9
0
    private void Start()
    {
        WorldControl.GetInstance().OnHPChanged     += OnValueChanged;
        WorldControl.GetInstance().OnRocketCreated += OnRocketCreated;

        var rocket = WorldControl.GetInstance().GetRocketControl();

        if (rocket)
        {
            OnRocketCreated(rocket);
        }
    }
Ejemplo n.º 10
0
    override public void OnEngineStart()
    {
        ParticleSystem particleSystem = GetComponent <ParticleSystem>();

        if (particleSystem != null)
        {
            particleSystem.Play();
        }
        transform.parent.GetComponent <Rigidbody2D>().AddForce((Vector2)transform.parent.up * m_power * Time.deltaTime);
        if (m_engineStartSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(m_engineStartSound);
        }
    }
Ejemplo n.º 11
0
    public void Activate()
    {
        if (m_state != State.Inactive)
        {
            return;
        }

        m_state = State.Active;
        if (m_particleSystem)
        {
            m_particleSystem.Play();
        }

        WorldControl.GetInstance().ShowMessage("Checkpoint activated!");
    }
Ejemplo n.º 12
0
    public bool InitWithMapIdx(int mapIdx)
    {
        m_mapIdx = mapIdx;
        var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx);

        if (mapPaths == null)
        {
            m_textMapName.text = $"MISSING {mapIdx}";
            SetIconSprite(MapsHelper.GetDefaultIcon());
            return(false);
        }

        m_textMapName.text = mapPaths.Name;
        SetIconSprite(mapPaths.GetMapIcon());
        return(true);
    }
Ejemplo n.º 13
0
    private void UpdateScrollContent()
    {
        ClearScroll();

        var mapList = WorldControl.GetInstance().MapList;

        for (var i = 0; i < mapList.Count; ++i)
        {
            var itemController = Instantiate(m_mapItemPrefab, m_scroll.content);
            if (itemController.InitWithMapIdx(i))
            {
                itemController.OnPressed += OnMapSelected;
            }
            else
            {
                Destroy(itemController.gameObject);
            }
        }
    }
Ejemplo n.º 14
0
    public virtual void OnEngineStop()
    {
        ParticleSystem particleSystem = GetComponent <ParticleSystem>();

        if (particleSystem)
        {
            particleSystem.Stop();
        }

        if (m_engineStopSound)
        {
            WorldControl.GetInstance().soundController.PlayShortSound(m_engineStopSound);
        }

        if (m_engineWorkingSound)
        {
            WorldControl.GetInstance().soundController.StopEngineSound();
        }
    }
Ejemplo n.º 15
0
    public void Reset()
    {
        m_isAlive       = true;
        m_enableControl = true;
        HealthCurrent   = m_durability;
        WorldControl.GetInstance().CallHpChanged(HealthCurrent);

        if (rocketObject)
        {
            rocketObject.SetActive(true);
        }

        if (destroyedRocketObject)
        {
            destroyedRocketObject.SetActive(false);
        }

        m_engineControl.SetEngineActive(false);
    }
Ejemplo n.º 16
0
    private void Update()
    {
        if (!m_enableControl || !WorldControl.GetInstance().IsInGame || WorldControl.GetInstance().IsPaused)
        {
            return;
        }

        var isEngine = Input.GetButton("Jump");

        m_engineControl.SetEngineActive(isEngine);

        float rotation = Input.GetAxis("Horizontal");

        if (rotation != 0)
        {
            var sign = rotation > 0 ? -1 : 1;
            transform.Rotate(0, 0, sign * Time.deltaTime * (1 + m_agility / GetComponent <Rigidbody2D>().angularDrag), Space.Self);
        }
    }
Ejemplo n.º 17
0
    public void SetMapIdx(int mapIdx)
    {
        m_mapIdx = mapIdx;

        var mapPaths = WorldControl.GetInstance().MapList.GetMapPaths(mapIdx);

        if (mapPaths == null)
        {
            SetActive(false);
            return;
        }

        var mapInfo = Resources.Load <MapInfo>(mapPaths.PrefabPath);

        m_imageIcon.sprite        = mapInfo.m_mapIcon;
        m_imageMiniMap.sprite     = mapInfo.m_miniImage;
        m_textMapName.text        = mapInfo.m_mapName;
        m_textMapDescription.text = mapInfo.m_mapDiscription;
        m_textMapGravity.text     = string.Format(m_stringGravity, mapInfo.m_mapGravity);
        m_textMapDrag.text        = string.Format(m_stringDrag, mapInfo.m_mapDrag);
        m_textMapFriction.text    = string.Format(m_strinFriction, mapInfo.m_mapFriction);
        m_textMapBounciness.text  = string.Format(m_strinBounciness, mapInfo.m_mapBounciness);
    }
Ejemplo n.º 18
0
    public override void OnTrigerStay(RocketControl rocket)
    {
        if (m_state != State.Timer)
        {
            return;
        }

        m_timeLeft -= Time.deltaTime;
        if (m_timeLeft <= 0)
        {
            m_state = State.Checked;
            if (m_particleSystem)
            {
                m_particleSystem.Stop();
            }
            m_collider.enabled = false;
            WorldControl.GetInstance().ShowMessage("Checkpoint collected!");
            WorldControl.GetInstance().OnTargetZoneChecked();
        }
        else
        {
            WorldControl.GetInstance().ShowMessage("Checkpoint will be collected in (" + string.Format("{0:0.00}", Mathf.Round(m_timeLeft * 100.0f) / 100.0f) + ")");
        }
    }
Ejemplo n.º 19
0
 public void OnPauseButtonPressed()
 {
     WorldControl.GetInstance().SetPause(true);
 }
Ejemplo n.º 20
0
 public void OnMusicValueChanged(Slider slider)
 {
     WorldControl.GetInstance().SetMusicVolume(slider.value);
 }
Ejemplo n.º 21
0
    private IEnumerator RestartCrt()
    {
        yield return(new WaitForSeconds(2));

        WorldControl.GetInstance().RestartFromCheckpoint();
    }
Ejemplo n.º 22
0
 public void OnButtonContinuePressed()
 {
     SetActive(false);
     WorldControl.GetInstance().SetPause(false);
 }
Ejemplo n.º 23
0
 public void OnSoundValueChanged(Slider slider)
 {
     WorldControl.GetInstance().SetFXVolume(slider.value);
 }
Ejemplo n.º 24
0
 public void OnButtonRestartLevelPressed()
 {
     WorldControl.GetInstance().RestartLevel();
     SetActive(false);
 }
Ejemplo n.º 25
0
 public void Start()
 {
     WorldControl.GetInstance().OnRocketCreated += OnRocketCreated;
 }
Ejemplo n.º 26
0
 private void Start()
 {
     m_textMessage.text = "";
     WorldControl.GetInstance().OnMessage += OnMessage;
 }
Ejemplo n.º 27
0
 protected override void OnActivated()
 {
     m_sliderSound.value = WorldControl.GetInstance().GetFXVolume();
     m_sliderMusic.value = WorldControl.GetInstance().GetMusicVolume();
 }