Permalink
Cannot retrieve contributors at this time
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?
SpaceKitten/Assets/Scripts/OutPortal.cs
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
54 lines (48 sloc)
1.11 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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); | |
} | |
} |