void Die() { MeshRenderer[] mr = GetComponentsInChildren <MeshRenderer> (); if (mr.Length > 0) { foreach (var item in mr) { item.enabled = false; } } TopDownController tc = GetComponent <TopDownController> (); if (tc) { tc.enabled = false; } BodySockets bs = GetComponent <BodySockets> (); if (bs) { bs.transportSocket.transport.gameObject.SetActive(false); foreach (var item in bs.primaryWeaponSockets) { item.primaryWeapon.gameObject.SetActive(false); } } Collider col = GetComponent <Collider> (); if (col) { col.enabled = false; } }
// Use this for initialization void Start() { _playerInstance = Instantiate <GameObject> (playerPrefab); playerBody = _playerInstance.GetComponentInChildren <BodySockets> (); enemyInstances = new List <SpawnableObject>(); propInstances = new List <SpawnableObject>(); _playerInstance.SetActive(false); }
void OnTriggerStay(Collider other) { if (gameObject.layer == LayerMask.NameToLayer("Item")) { if (Input.GetButtonDown("EquipLeft") || Input.GetButtonDown("EquipRight")) { transform.localRotation = Quaternion.Euler(0, 0, 0); BodySockets oBS = other.GetComponent <BodySockets> (); oBS.DetachTransport(false); oBS.AttachTransport(GetComponent <TransportNode>()); } } }
void OnTriggerStay(Collider other) { if (gameObject.layer == LayerMask.NameToLayer("Item")) { if (Input.GetButtonDown("EquipLeft")) { transform.localRotation = Quaternion.Euler(0, 0, 0); transform.localPosition = Vector3.zero; transform.localScale = Vector3.one; BodySockets oBS = other.GetComponent <BodySockets> (); oBS.DetachPrimaryWeapon(0, false); oBS.AttachPrimaryWeapon(0, GetComponent <PrimaryWeaponNode>()); } if (Input.GetButtonDown("EquipRight")) { transform.localRotation = Quaternion.Euler(0, 0, 0); transform.localPosition = Vector3.zero; transform.localScale = Vector3.one; BodySockets oBS = other.GetComponent <BodySockets> (); oBS.DetachPrimaryWeapon(1, false); oBS.AttachPrimaryWeapon(1, GetComponent <PrimaryWeaponNode>()); } } }
// Use this for initialization void Start() { mainBody = GetComponent <BodySockets> (); a = GetComponent <Animator> (); }
// Use this for initialization void Start() { bs = GetComponent <BodySockets> (); sp = GetComponent <SpawnableObject> (); dmg = GetComponent <DamageableItem> (); }
void Start() { bs = GetComponent <BodySockets> (); }