Esempio 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());
    }
Esempio n. 2
0
    public void OnButtonEndLevelPressed()
    {
        WorldControl.GetInstance().EndLevel();

        DialogsController.GetInstance().ShowDialog(DialogType.StartMenu);
        SetActive(false);
    }
Esempio n. 3
0
 void Start()
 {
     if (m_engineWorkingSound)
     {
         WorldControl.GetInstance().soundController.SetEngineAudioClip(m_engineWorkingSound);
     }
 }
Esempio 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);
 }
Esempio n. 5
0
    public void ApplyDamage(float damageAmount)
    {
        HealthCurrent -= damageAmount;
        WorldControl.GetInstance().CallHpChanged(HealthCurrent);

        if (HealthCurrent <= 0)
        {
            OnKilled();
        }
    }
Esempio 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!");
    }
    public void OnButtonStartPressed()
    {
        if (WorldControl.GetInstance() == null)
        {
            return;
        }

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

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

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

        if (rocket)
        {
            OnRocketCreated(rocket);
        }
    }
Esempio 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);
        }
    }
Esempio 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!");
    }
Esempio 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);
    }
Esempio 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);
            }
        }
    }
Esempio 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();
        }
    }
Esempio 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);
    }
Esempio 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);
        }
    }
    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);
    }
Esempio 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) + ")");
        }
    }
Esempio n. 19
0
 public void OnPauseButtonPressed()
 {
     WorldControl.GetInstance().SetPause(true);
 }
Esempio n. 20
0
 public void OnMusicValueChanged(Slider slider)
 {
     WorldControl.GetInstance().SetMusicVolume(slider.value);
 }
Esempio n. 21
0
    private IEnumerator RestartCrt()
    {
        yield return(new WaitForSeconds(2));

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