Quantcast
Channel: Questions in topic: "namespace"
Viewing all articles
Browse latest Browse all 398

Using 2 different namespaces

$
0
0
I am using 2 different set of codes that both have their own namespaces. One is for a water emulator and one for my custom ThirdPerson Controller. Now the problem is that i want to create a detector script that when the player enters the water to kill him. As you can imagine i need to somehow use 2 namespaces in that script...because one is 'grabbing' info from the water script and one from the Player's controller. Is there a way i can access both namespace objects in that script ? using UnityEngine; using System.Collections; namespace ------WhatToUseHere???-------- (MyWaterSim or ThirdPersonCharacter namespace) { public class DetectAndKill : MonoBehaviour { public WaterSim watersim; void Update() { transform.position = new Vector3(transform.position.x, watersim.waterSurface, transform.position.z); } void OnTriggerEnter(Collider other) { if (other.tag == "Player") { ThirdPersonCharacter player = other.GetComponent(); player.die(); } } } } The detector will be applied to a gameobject that will change its Y position according to the water surface. Then if the player lands on it...it should send a message to kill the player. Now i dont want to use the same namespace for both scripts...because if you think about it...i might use in the future another script that uses its own namespace variable...so i cant be doing this every time i add something new to the code....Isnt there an easy way to access both scripts ? -Thanks

Viewing all articles
Browse latest Browse all 398

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>