This file contains hidden or 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
var encode = "abcdefg !@#$%^&*()" | |
var decode = "zyxwvut"; | |
var swapValue = { | |
a:"z", | |
b:"y", | |
c:"x", | |
d:"w", | |
e:"v", | |
f:"u", |
This file contains hidden or 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
void OnCollisionExit(Collision collisionInfo) { | |
// not calling collisionInfo at this time but we can get the additional information using | |
// for example: collisionInfo.transform.name | |
// change player's color to red when collision is ended (not touching each other) | |
gameObject.GetComponent<Renderer>().material.color = Color.red; | |
} |
This file contains hidden or 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
void OnCollisionEnter(Collision target) { | |
// create a gameobject (a cube for this demo) name it "enemy" | |
// and your argument(target) is setup so that object can be collided with | |
if (target.gameObject.name == "enemy") { | |
// Change the player's color to green when collide occurs | |
gameObject.GetComponent<Renderer>().material.color = Color.green; | |
} | |
} |
This file contains hidden or 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
void Update () { | |
//Debug.Log(Input.GetAxis("Horizontal")); | |
transform.Translate(Input.GetAxis("Horizontal") * Time.deltaTime, 0f, Input.GetAxis("Vertical") * Time.deltaTime); | |
} | |
NewerOlder