Пример #1
0
 private void Select(int i)
 {
     ParticleSceneControls.selected = this.demoParticles.items[i];
     this.instance = null;
     ParticleSceneControls.DemoParticleSystem[] items = this.demoParticles.items;
     for (int j = 0; j < items.Length; j++)
     {
         ParticleSceneControls.DemoParticleSystem demoParticleSystem = items[j];
         if (demoParticleSystem != ParticleSceneControls.selected && demoParticleSystem.mode == ParticleSceneControls.Mode.Activate && demoParticleSystem != null)
         {
             demoParticleSystem.transform.gameObject.SetActive(false);
         }
     }
     if (ParticleSceneControls.selected.mode == ParticleSceneControls.Mode.Activate)
     {
         ParticleSceneControls.selected.transform.gameObject.SetActive(true);
     }
     this.particleMultiplier = ParticleSceneControls.selected.transform.GetComponent <ParticleSystemMultiplier>();
     this.multiply           = 1f;
     if (this.clearOnChange)
     {
         while (this.currentParticleList.Count > 0)
         {
             UnityEngine.Object.Destroy(this.currentParticleList[0].gameObject);
             this.currentParticleList.RemoveAt(0);
         }
     }
     this.interactionGuiText.text = ParticleSceneControls.selected.instructionText;
     this.titleGuiText.text       = ParticleSceneControls.selected.transform.name;
 }
Пример #2
0
    void Select(int i)
    {
        selected = demoParticles.items[i];
        instance = null;
        foreach (var otherEffect in demoParticles.items)
        {
            if ((otherEffect != selected) && (otherEffect.mode == Mode.Activate))
            {
                if (otherEffect != null)
                {
                    otherEffect.transform.gameObject.SetActive(false);
                }
            }
        }
        if (selected.mode == Mode.Activate)
        {
            selected.transform.gameObject.SetActive(true);
        }
        particleMultiplier = selected.transform.GetComponent <ParticleSystemMultiplier>();
        multiply           = 1;
        if (clearOnChange)
        {
            while (currentParticleList.Count > 0)
            {
                Destroy(currentParticleList[0].gameObject);
                currentParticleList.RemoveAt(0);
            }
        }

        interactionGuiText.text = selected.instructionText;
        titleGuiText.text       = selected.transform.name;
    }
    public void Select(int i)
    {
        s_Selected = demoParticles.items[i];
        m_Instance = null;
        foreach (var otherEffect in demoParticles.items)
        {
            if ((otherEffect != s_Selected) && (otherEffect.mode == Mode.Activate))
            {
                otherEffect.transform.gameObject.SetActive(false);
            }
        }
        if (s_Selected.mode == Mode.Activate)
        {
            s_Selected.transform.gameObject.SetActive(true);
        }
        m_ParticleMultiplier = s_Selected.transform.GetComponent<ParticleSystemMultiplier>();
        multiply = 1;
        if (clearOnChange)
        {
            while (m_CurrentParticleList.Count > 0)
            {
                Destroy(m_CurrentParticleList[0].gameObject);
                m_CurrentParticleList.RemoveAt(0);
            }
        }

        //titleText.text = s_Selected.transform.name;
    }
Пример #4
0
    private void Awake()
    {
        _muzzleFlash = GetComponentInChildren <ParticleSystem>();

        psm = _deathExplosionFX.GetComponent <ParticleSystemMultiplier>();
        originalPosition = transform.localPosition;
        liftPosition     = originalPosition + liftOffset;
        reticle.SetActive(false);
    }
Пример #5
0
    // Use this for initialization
    void Start()
    {
        checkbox.SetActive(false);
        ParticleSystemMultiplier SysMul = GetComponent <ParticleSystemMultiplier>();

        multiplier    = SysMul.multiplier;
        reduceFactor *= multiplier;
        audioS        = GetComponent <AudioSource>();
    }
Пример #6
0
    void Start()
    {
        visual = GameObject.Instantiate(visualPrefab);
        visual.transform.parent        = transform;
        visual.transform.localPosition = Vector3.zero;

        visualScaler = visual.GetComponent <ParticleSystemMultiplier>();

        StartCoroutine(Spreading());
    }
Пример #7
0
	// Use this for initialization
	void Start()
	{
		checkbox.SetActive(false);
		ParticleSystemMultiplier sysMul = GetComponent<ParticleSystemMultiplier>();
		multiplier = sysMul.multiplier;
		_audioSource = GetComponent<AudioSource>();
		
		// This is called every time a GameObject with this script is set to active
		// Add fire
		_gameManager = GameManager.instance;
		_gameManager.AddFire();
		
		// Change tag to "Fire" so we know it won't be lit randomly later
		this.gameObject.tag = "Fire";
	}
Пример #8
0
    IEnumerator SpawnChild()
    {
        if (transform.localScale.x > 0.25f)
        {
            Asteroid asteroidClone = Instantiate(asteroidPrefabs[Random.Range(0, asteroidPrefabs.Length)]) as Asteroid;
            asteroidClone.transform.position   = transform.position;
            asteroidClone.transform.rotation   = Random.rotation;
            asteroidClone.transform.localScale = Vector3.one * (transform.localScale.x - 0.25f);
            yield return(null);

            asteroidClone.gameObject.SetActive(true);
        }

        ParticleSystemMultiplier explosionInstance = Instantiate(explosionPrefab) as ParticleSystemMultiplier;

        explosionInstance.multiplier         = transform.localScale.x;
        explosionInstance.transform.position = transform.position;
    }
Пример #9
0
    void OnCollisionEnter(Collision collision)
    {
        health -= collision.relativeVelocity.sqrMagnitude;

        if (health <= 0f)
        {
            Camera.main.transform.parent = null;
            ParticleSystemMultiplier instance = Instantiate(explosionPrefab) as ParticleSystemMultiplier;
            instance.multiplier         = 2f;
            instance.transform.position = transform.position;
            Destroy(gameObject);

            MainUI.SetHealth(0);
            MainUI.ShowGameOver();
        }
        else
        {
            MainUI.SetHealth(health);
        }
    }
Пример #10
0
    // Update is called once per frame
    void Update()
    {
        if (Input.GetMouseButtonDown(0))
        {
            //var bullet = Resources.Load("Bullet");
            //Instantiate(bullet, this.transform.position, this.transform.rotation);

            RaycastHit hit;
            Ray        ray = new Ray(transform.position, transform.forward);
            Debug.DrawRay(ray.origin, ray.direction, Color.magenta, 60);

            if (Physics.Raycast(ray, out hit, 1000) == true)
            {
                if (hit.transform.gameObject.tag == "Cube")
                {
                    Debug.DrawLine(ray.origin, hit.point, Color.cyan, 60);
                    Rigidbody hitRigidbody = hit.transform.gameObject.GetComponent <Rigidbody>();

                    if (hitRigidbody != null)
                    {
                        GameObject explosion = GameObject.FindGameObjectWithTag("Explosion");

                        if (explosion != null)
                        {
                            ParticleSystemMultiplier psm = explosion.GetComponent <ParticleSystemMultiplier>();
                            if (psm != null)
                            {
                                psm.activate();
                            }
                        }
                        hitRigidbody.AddExplosionForce(10f, hit.point, 2f, 5f, ForceMode.Impulse);
                        Debug.Log("Should explode");
                    }
                }
                Debug.Log(hit.transform.gameObject.tag);
            }
        }
    }
	void Select(int i)
	{
		selected = demoParticles.items[i];
		instance = null;
		foreach (var otherEffect in demoParticles.items)
		{
			if ((otherEffect != selected) && (otherEffect.mode == Mode.Activate))
			{
				if (otherEffect != null)
				{
					otherEffect.transform.gameObject.SetActive(false);
				}
			}
		}
		if (selected.mode == Mode.Activate)
		{
			selected.transform.gameObject.SetActive(true);
		}
		particleMultiplier = selected.transform.GetComponent<ParticleSystemMultiplier>();
		multiply = 1;
		if (clearOnChange)
		{
			while(currentParticleList.Count > 0)
			{
				Destroy (currentParticleList[0].gameObject);
				currentParticleList.RemoveAt(0);
			}
		}

		interactionGuiText.text = selected.instructionText;
		titleGuiText.text = selected.transform.name;
	}