void OnTriggerEnter(Collider other) { ID_Manager tempID_Manager = (ID_Manager)other.transform.root.GetComponent("ID_Manager"); if (tempID_Manager == null) { return; } //make sure you aren't hitting self or hitting someone repeatedly for (int i = 0; i < ids.Count; i++) { if (tempID_Manager.ID == ids[i]) { return; } } //make sure it's a player being hit PowerUpHit tempPowerUpHit = other.transform.root.gameObject.GetComponent <PowerUpHit>(); if (!tempPowerUpHit) { return; } ids.Add(tempID_Manager.ID); //perform general hit tempPowerUpHit.GeneraliHit(); }
void Start() { //find self ID_Manager ID_Script = (ID_Manager)this.transform.root.GetComponent("ID_Manager"); checkID = ID_Script.ID; //find socket, and create weapon Transform tempTransform = this.transform.root.Find("Frame1/CatapultAttachJoint"); //to hold GO with CatapultScript wep = (GameObject)Instantiate((GameObject)Resources.Load("SunThrow"), tempTransform.position, tempTransform.rotation); wep.transform.root.parent = tempTransform; //find pivot points, and starting positions startPosition = new Vector3(-.35f, .19f, 1.32f); mesh = wep.transform; mesh.localPosition = startPosition; pivotPoint = mesh.transform.FindChild("PivotPoint"); SunPosition = mesh.transform.FindChild("SunPosition"); rotateBegin = Quaternion.Euler(new Vector3(57, 340, 50)); //set initial rotations mesh.localRotation = rotateBegin; rotateMiddle = Quaternion.Euler(new Vector3(333, 355, 80)); rotateEnd = Quaternion.Euler(new Vector3(81, 150, 73)); wep.SetActive(false); rootName = this.transform.root.name; }
void Awake() { if (instance != null) { Debug.LogError("More than one ID_Manager in scene."); } else { instance = this; } }
public override void OnStartClient() { if (hasAuthority) { base.OnStartClient(); string _netID = GetComponent <NetworkIdentity>().netId.ToString(); PlayerHealth _player = GetComponent <PlayerHealth>(); Debug.Log(_player.name); ID_Manager.RegisterPlayer(_netID, _player); } }
void OnTriggerEnter(Collider other) { //make it's the player being hit, and not their weapon or a projectile PowerUpHit tempPowerUpHit = other.transform.root.gameObject.GetComponent <PowerUpHit>(); if (!tempPowerUpHit) { return; } //prevent you from hitting yourself with the ability ID_Manager tempID_Manager = (ID_Manager)other.transform.root.GetComponent("ID_Manager"); if (tempID_Manager.ID == checkID) { return; } //general hit causes player to flip and halt movement for a moment tempPowerUpHit.GeneraliHit(); }
// When we are destroyed void OnDisable() { ID_Manager.UnRegisterPlayer(transform.name); }
private void Start() { ID = ID_Manager.GiveSourceID(); GiveIDs(); }
void Start() { ID_Manager ID_Script = (ID_Manager)this.transform.root.GetComponent("ID_Manager"); checkID = ID_Script.ID; }