Last active
December 24, 2019 15:17
-
-
Save ayutaz/971413f526893516f39308246ced4265 to your computer and use it in GitHub Desktop.
Particleを使用してエフェクト効果をつける(Unity,Particle pack)
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 System.Collections; | |
using System.Collections.Generic; | |
using UnityEngine; | |
public class CreateMagic : MonoBehaviour | |
{ | |
public GameObject Prefab1; | |
public GameObject Prefab2; | |
public GameObject Prefab3; | |
public GameObject Prefab4; | |
public GameObject Prefab5; | |
public GameObject Prefab6; | |
public GameObject Prefab7; | |
public GameObject Prefab8; | |
public GameObject Prefab9; | |
private GameObject obj; | |
private GameObject Pre; | |
private Vector3 position; | |
// Start is called before the first frame update | |
void Start() | |
{ | |
obj = GameObject.Find("Create"); | |
} | |
// Update is called once per frame | |
void Update() | |
{ | |
position = new Vector3(Random.Range(0f,10f),0f,0f); | |
if(Input.GetKeyDown(KeyCode.F1)) { | |
Pre = (GameObject)Instantiate (Prefab1,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F2)){ | |
Pre = (GameObject)Instantiate (Prefab2,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F3)){ | |
Pre = (GameObject)Instantiate (Prefab3,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F4)){ | |
Pre = (GameObject)Instantiate (Prefab4,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F5)){ | |
Pre = (GameObject)Instantiate (Prefab5,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F6)){ | |
Pre = (GameObject)Instantiate (Prefab6,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F7)){ | |
Pre = (GameObject)Instantiate (Prefab7,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F8)){ | |
Pre = (GameObject)Instantiate (Prefab8,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
}else if(Input.GetKeyDown(KeyCode.F9)){ | |
Pre = (GameObject)Instantiate (Prefab9,position, Quaternion.identity); | |
Pre.transform.parent = obj.transform; | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
スクリプトの種類を設定