Skip to content
Permalink
aee962d2c7
Switch branches/tags

Name already in use

A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Go to file
 
 
Cannot retrieve contributors at this time
54 lines (48 sloc) 1.11 KB
using UnityEngine;
using System.Collections;
public class OutPortal : MonoBehaviour {
public float rotateSpeed;
private Vector3 rotateZ;
public bool hitP = false;
private int counter = 0;
private ParticleSystem particles;
void Start() {
particles = GetComponent<ParticleSystem> ();
}
void OnTriggerEnter(Collider other) {
if (other.tag=="Player"){
hitP=true;
particles.emissionRate *= 3;
rotateSpeed *= 3;
}
}
void Update () {
counter ++;
if (counter == 50){ counter = 0;}
int colorpick = counter%10;
if (hitP){
switch (colorpick) {
case 0:
particles.startColor = new Color(0.9f, 0.3f, 0.3f);
break;
case 1:
particles.startColor = new Color(0.9f, 0.9f, 0.3f);
break;
case 2:
particles.startColor = new Color(0.3f, 0.9f, .3f);
break;
case 3:
particles.startColor = new Color(0.3f, 0.9f, 0.9f);
break;
case 4:
particles.startColor = new Color(0.3f, 0.3f, 0.9f);
break;
case 5:
particles.startColor = new Color(0.9f, 0.3f, 0.9f);
break;
}
}
rotateZ.z = rotateSpeed;
transform.Rotate(rotateZ, Space.World);
}
}