Партнерка на США и Канаду по недвижимости, выплаты в крипто
- 30% recurring commission
- Выплаты в USDT
- Вывод каждую неделю
- Комиссия до 5 лет за каждого referral
isSlide = true;
gameObject. GetComponent<Transform> ().GetComponent<BoxCollider2D> ().isTrigger = true;
}
if (Input. GetKeyUp (KeyCode. LeftShift)) {
gameObject. GetComponent<Transform> ().GetComponent<BoxCollider2D> ().isTrigger = false;
isSlide = false;
}
if (isThrow && isGrounded)
move = 0f;
else if(!isThrow && isGrounded) move = 1f;
}
//Реализация триггеров
void OnTriggerEnter2D(Collider2D col){
//При соприкосновении с коллайдером "смерти" (невидимый объект, при столкновении с которым, персонаж зараняется)
if ((col. gameObject. name == "dieCollider"))
{
if (!inAche) {
if (!isSlide) {
inAche = true;
if (!anim. GetBool ("jump") && !anim. GetBool ("fall") && !anim. GetBool ("ache")) {
rigid2d. velocity = new Vector2 (0, 0);
rigid2d. AddForce (new Vector2 (0, 700f));
} else if (!isSlide) {
rigid2d. velocity = new Vector2 (0, 0);
rigid2d. AddForce (new Vector2 (0, 700f));
}
}
}
}
if (col. gameObject. name == "endLevel") {
Application. LoadLevel ("win");
}
if (col. gameObject. name == "throwCollider") {
inAche = true;
isThrow = true;
rigid2d. velocity = new Vector2 (0, 0);
rigid2d. AddForce (new Vector2 (0, 500f));
move = -1f;
}
if (col. gameObject. name == "clock") {
clockBonus = true;
Destroy (col. gameObject);
}
if (col. gameObject. name == "balloon") {
anim. SetBool ("boom", true);
}
}
}
Класс balloon
using UnityEngine;
using System. Collections;
public class balloon : MonoBehaviour {
public Animator anim;
public float r;
// Use this for initialization
void Start ()
{
anim = GetComponent<Animator> ();
r = (float)Random. Range(-3f, 3f);
}
// Update is called once per frame
void Update ()
{
transform. Translate(r/30, 0, r*Time. deltaTime);
}
void OnTriggerEnter2D(Collider2D col){
if (col. gameObject. name == "Ivan") {
anim. SetBool ("boom", true);
}
}
}
Класс door
using UnityEngine;
using System. Collections;
public class door : MonoBehaviour {
public int kick = 0;
// Use this for initialization
void Start () {
kick = 0;
}
// Update is called once per frame
void Update () {
}
void OnTriggerEnter2D(Collider2D col){
if (col. gameObject. name == "Ivan") {
kick = 1;
}
}
}
Класс doorKick
using UnityEngine;
using System. Collections;
public class doorKick : door
{
public Transform target;
public Transform target2;
// Update is called once per frame
void Update ()
{
if (kick == 1)
{
GetComponent<Rigidbody2D> ().AddForce (new Vector2 (800, 800));
GetComponent<BoxCollider2D> ().enabled = false;
kick = 2;
}
if(kick == 2) GetComponent<Rigidbody2D> ().MoveRotation (20);
}
}
Класс healthBar
using UnityEngine;
using System. Collections;
public class healthBar : MonoBehaviour {
public int health;
public Texture2D cutlet;
public Texture2D clock;
bool inAche = false;
bool clockBonus = false;
public float timer;
// Use this for initialization
void Start () {
health = 2;
timer = 0.4f;
}
// Update is called once per frame
void Update () {
inAche = GameObject. Find ("Ivan").GetComponent<characterController> ().inAche;
clockBonus = GameObject. Find ("Ivan").GetComponent<characterController> ().clockBonus;
if (health == 0) {
Time. timeScale = 0.1f;
if (timer > 0)
timer -= Time. deltaTime;
else
Application. LoadLevel ("death");
}
}
private void OnGUI(){
// Create one Group to contain both images
// Adjust the first 2 coordinates to place it somewhere else on-screen
GUI. BeginGroup (new Rect (0,0,200,32));
GUI. Box (new Rect (0,0,64,32), cutlet);
GUI. Box (new Rect (64,0,64,32), "x" + health);
GUI. EndGroup ();
GUI. BeginGroup (new Rect (0,32,64,32));
if(clockBonus)
GUI. Box (new Rect (0,0,64,32), clock);
else GUI. Box (new Rect (0,0,64,32), "");
GUI. EndGroup ();
}
private void OnTriggerEnter2D(Collider2D col){
//При соприкосновении с коллайдером "смерти" (невидимый объект, при столкновении с которым, персонаж зараняется)
if ((col. gameObject. name == "dieCollider") && !inAche) {
health--;
Destroy (col. gameObject);
}
if ((col. gameObject. name == "cutlet")) {
if (health < 3) {
health++;
}
Destroy (col. gameObject);
}
}
}
Класс lvlIndex
using UnityEngine;
using System. Collections;
public class lvlIndex : MonoBehaviour {
public string lvl;
// Use this for initialization
// Update is called once per frame
void Update () {
lvl = Application. loadedLevelName;
DontDestroyOnLoad (gameObject);
}
}
Класс Music
using UnityEngine;
using System. Collections;
public class Music : MonoBehaviour
{
public AudioClip a1, a2, a3, a4, a5;
public AudioSource audio;
// Use this for initialization
void Start () {
int r = (int)Random. Range(0, 4);
switch (r) {
case 0:
audio. PlayOneShot (a1);
break;
case 1:
audio. PlayOneShot (a2);
break;
case 2:
audio. PlayOneShot (a3);
break;
case 3:
audio. PlayOneShot (a4);
break;
case 4:
audio. PlayOneShot (a5);
break;
}
}
Класс newcam
using UnityEngine;
using System. Collections;
public class newcam : MonoBehaviour {
public float dampTime = 0.15f;
private Vector3 velocity = Vector3.zero;
public Transform target;
// Update is called once per frame
void Update ()
{
if (target)
{
Vector3 point = Camera. main. WorldToViewportPoint(new Vector3(target. position. x, target. position. y+0.75f, target. position. z));
Vector3 delta = new Vector3(target. position. x+10, target. position. y+3f, target. position. z) - Camera. main. ViewportToWorldPoint(new Vector3(0.5f, 0.5f, point. z)); //(new Vector3(0.5, 0.5, point. z));
Vector3 destination = transform. position + delta;
transform. position = Vector3.SmoothDamp(transform. position, destination, ref velocity, dampTime);
}
}
}
Класс timer
using UnityEngine;
using System. Collections;
using System;
using System. IO;
public class timer : MonoBehaviour {
public int t;
private int startTime = 0;
//public string level;
void Start()
{
if(Application. loadedLevelName == "SSI")
File. WriteAllText ("E:\\Supersonic Ivan\\score. txt", Convert. ToString(0));
}
// Use this for initialization
void OnEnable()
{
startTime = (int)Time. time;
}
public int globalTimer()
{
t = (int)Time. time - startTime;
return 60 - t;
}
// Update is called once per frame
void Update () {
if (globalTimer () == 0)
Application. LoadLevel ("death");
}
void OnGUI(){
GUI. Box (new Rect (250, 0, 100, 32), "Время " + globalTimer());
}
void OnDestroy() {
int score = Convert. ToInt32(File. ReadAllText ("E:\\Supersonic Ivan\\score. txt"));
score += globalTimer ();
File. WriteAllText ("E:\\Supersonic Ivan\\score. txt", Convert. ToString(score));
}
}
Класс next
using UnityEngine;
using System. Collections;
using System. IO;
using System;
public class next : MonoBehaviour {
int score;
string lvl;
// Use this for initialization
void Start () {
score = Convert. ToInt32(File. ReadAllLines ("E:\\Supersonic Ivan\\score. txt")[0]);
lvl = GameObject. Find ("lvlIndex").GetComponent<lvlIndex> ().lvl;
}
// Update is called once per frame
void Update () {
if (Input. GetKey (KeyCode. Escape)) {
Application. Quit();
}
if (Input. GetKey (KeyCode. E)) {
switch(lvl){
case "SSI":
Application. LoadLevel ("SSI2");
break;
case "SSI2":
Application. LoadLevel ("SSI3");
break;
case "SSI3":
Application. LoadLevel ("SSI4");
break;
case "SSI4":
Application. LoadLevel ("SSI5");
break;
}
}
}
void OnGUI(){
GUI. Box (new Rect (250, 0, 100, 32), "Очки " + score);
}
}
Класс again
using UnityEngine;
using System. Collections;
public class again : timer {
public string lvl;
// Use this for initialization
void Start () {
lvl = GameObject. Find ("lvlIndex").GetComponent<lvlIndex> ().lvl;
}
// Update is called once per frame
void Update () {
lvl = GameObject. Find ("lvlIndex").GetComponent<lvlIndex> ().lvl;
if (Input. GetKey (KeyCode. E)) {
Application. LoadLevel (lvl);
}
}
}
|
Из за большого объема этот материал размещен на нескольких страницах:
1 2 3 4 |


