Тема: Толчок
Показать сообщение отдельно
Старый 10.08.2014, 15:25   #14
6082asil
AnyKey`щик
 
Регистрация: 09.08.2014
Сообщений: 16
Написано 0 полезных сообщений
(для 0 пользователей)
Ответ: Толчок

using UnityEngine;
using System.Collections;

[RequireComponent (typeof (Rigidbody))]

public class spacebarImpulse : MonoBehaviour {

	

	void Start () {
		
	}

	void Update () {
		if(Input.GetKeyDown(KeyCode.Space)) {
			GameObject.Find("astar").GetComponent<AstarPath>().enabled = !GameObject.Find("astar").GetComponent<AstarPath>().enabled;
			GameObject.Find("enemy1").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy1").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy2").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy2").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy3").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy3").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy4").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy4").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy5").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy5").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy6").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy6").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy7").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy7").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy8").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy8").GetComponent<AIFollow>().enabled;
			GameObject.Find("enemy9").GetComponent<AIFollow>().enabled = !GameObject.Find("enemy9").GetComponent<AIFollow>().enabled;
			rigidbody.AddExplosionForce(100,transform.position,10);
		}
	}
}
Вот скрипт.
-----
Ну с одной стороны, серьезный настрой, это конечно хорошо, а с другой - ну вы чего, шуток не понимаете чтоли?
(Offline)
 
Ответить с цитированием