Exemplo n.º 1
0
    public static RocketControl Create(RocketControl rocketPrefab, EngineControl enginePrefab, Transform targetTransform)
    {
        var rocket = Instantiate(rocketPrefab, targetTransform);

        rocket.SetEngine(enginePrefab);
        return(rocket);
    }
Exemplo n.º 2
0
	void Start () {
		pView = GetComponent<PhotonView>();
		rc = GetComponent<RocketControl>();
		if(pView.isMine)
			Respawn();

	}
Exemplo n.º 3
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);
 }
Exemplo n.º 4
0
    public override void OnTrigerExit(RocketControl rocket)
    {
        if (m_state != State.Timer)
        {
            return;
        }

        m_state = State.Active;
    }
Exemplo n.º 5
0
 void Start()
 {
     pView = GetComponent <PhotonView>();
     rc    = GetComponent <RocketControl>();
     if (pView.isMine)
     {
         Respawn();
     }
 }
Exemplo n.º 6
0
    public override void OnTriggered(RocketControl rocket)
    {
        if (m_state != State.Active)
        {
            return;
        }

        m_state    = State.Timer;
        m_timeLeft = m_timer;
    }
Exemplo n.º 7
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!");
    }
Exemplo n.º 8
0
    public override void OnTriggered(RocketControl rocket)
    {
        if (m_targetPosition == null)
        {
            return;
        }

        m_savedRocket = rocket;
        m_savedRocket.StartTeleport();
        StartCoroutine(DoTeleport());
    }
Exemplo n.º 9
0
    private void OnTriggerEnter2D(Collider2D collider)
    {
        if (!isAlive)
        {
            return;
        }

        int force = 0;

        if (collider.tag == "Laser")
        {
            force = 1;
        }

        else if (collider.tag == "Rocket")
        {
            RocketControl rc = collider.GetComponent <RocketControl>();

            if (rc != null)
            {
                rc.Boom();
            }

            force = 3;
        }

        if (force > 0)
        {
            type = (AsteroidType)Mathf.Max((float)type - force, 0);

            if (type == AsteroidType.DESTROYED)
            {
                asteroidsCount--;
                destroyParticles.Emit(30);
                boomParticles.Emit(10);
                Destroy(this.gameObject, 0.375f);
                isAlive = false;
                SoundManager.playSound(SoundManager.Sound.ASTEROID_DESTROY);
                OnDestroy();
            }
            else
            {
                boomParticles.Emit(30);
                SoundManager.playSound(SoundManager.Sound.ASTEROID_HIT);
            }

            animator.SetTrigger("boom");
        }

        setupByType();
    }
Exemplo n.º 10
0
 void Start()
 {
     rcontrol = GetComponent <RocketControl>();
     rhealth  = GetComponent <RocketHealth>();
     rb       = GetComponent <Rigidbody2D>();
     if (!GetComponent <PhotonView>().isMine)
     {
         gameObject.tag    = "Ship";
         MinimapMark.color = Color.red;
     }
     else
     {
         MinimapMark.color = Color.green;
     }
 }
Exemplo n.º 11
0
    public void Init()
    {
        Localization.selectLanguage("RU");
        m_gameSpeed = 1.0f;

        var rocketPrefab = RocketList.GetRocketPrefab(0);
        var enginePrefab = RocketList.GetEnginePrefab(0);

        m_rocketControl = RocketControl.Create(rocketPrefab, enginePrefab, m_playerTransform);
        OnRocketCreated?.Invoke(m_rocketControl);

        soundController.PlayMusic(Resources.Load <AudioClip>(AudioList.getAudioPath(getAudioNames() [0])));

        SetPause(true);
    }
Exemplo n.º 12
0
	void Start()
	{
		rcontrol = GetComponent<RocketControl>();
		rhealth = GetComponent<RocketHealth>();
		rb = GetComponent<Rigidbody2D>();
		if(!GetComponent<PhotonView>().isMine)
		{
			gameObject.tag = "Ship";
			MinimapMark.color = Color.red;
		}
		else
		{
			MinimapMark.color = Color.green;
		}
	}
Exemplo n.º 13
0
    void CheckInMenu()
    {
        if (rocket == null)
        {
            rocket = FindObjectOfType <RocketControl>();
        }

        if (rocket == null)
        {
            inMenu = true;
        }
        else
        {
            inMenu = false;
        }
    }
Exemplo n.º 14
0
    public override void OnTriggered(RocketControl rocket)
    {
        rocket.ApplyDamage(m_damage);

        if (m_collider != null)
        {
            m_collider.enabled = false;
        }

        if (m_bombSprite != null)
        {
            m_bombSprite.enabled = false;
        }

        if (m_explosionParticleSystem != null)
        {
            m_explosionParticleSystem.Play();
        }
    }
Exemplo n.º 15
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) + ")");
        }
    }
Exemplo n.º 16
0
 public virtual void OnTrigerStay(RocketControl rocket)
 {
 }
Exemplo n.º 17
0
 private void Start()
 {
     rocketControl          = GameObject.Find("Rocket").GetComponent <RocketControl>();
     roundStart_panel.alpha = 1;
     StartCoroutine(RoundStart());
 }
Exemplo n.º 18
0
 public void OnRocketCreated(RocketControl rocket)
 {
     m_rocket = rocket;
     GetComponent <Camera>().orthographicSize = m_zoom;
 }
Exemplo n.º 19
0
 public virtual void OnTriggered(RocketControl rocket)
 {
 }
Exemplo n.º 20
0
 public void OnRocketCreated(RocketControl rocket)
 {
     m_maxValue = rocket.HealthMax;
     OnValueChanged(rocket.HealthCurrent);
 }
Exemplo n.º 21
0
 void Awake()
 {
     rocket = GameObject.FindWithTag("Player").GetComponent <RocketControl>();
 }
Exemplo n.º 22
0
 public virtual void OnTrigerExit(RocketControl rocket)
 {
 }