Beispiel #1
0
    public static RocketControl Create(RocketControl rocketPrefab, EngineControl enginePrefab, Transform targetTransform)
    {
        var rocket = Instantiate(rocketPrefab, targetTransform);

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

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

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

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

        m_savedRocket = rocket;
        m_savedRocket.StartTeleport();
        StartCoroutine(DoTeleport());
    }
Beispiel #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();
    }
Beispiel #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;
     }
 }
Beispiel #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);
    }
Beispiel #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;
		}
	}
Beispiel #13
0
    void CheckInMenu()
    {
        if (rocket == null)
        {
            rocket = FindObjectOfType <RocketControl>();
        }

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