void Pulse(GameObject obj, Vector3 dir) { Vector3 extraAngle = new Vector3(0, 2, 0); // Schiet objecten iets omhoog Vector3 direction = Vector3.Scale(Vector3.Normalize(transform.position - (obj.transform.position + extraAngle)), dir); if (obj.tag == "Player" && obj.name != gameObject.name) { if (isServer) { GM_Flag flag = obj.GetComponentInChildren <GM_Flag>(); if (flag != null) { flag.CmdChangeFlagHolder(""); } } obj.gameObject.GetComponent <Player_Force>().AddImpact(direction, (2 * direction.magnitude) / obj.transform.localScale.x); } else if (obj.tag == "PhysicsObject" || obj.tag == "Ball") { obj.GetComponent <Rigidbody>().AddForce(direction * 25); if (obj.tag == "Ball") { obj.GetComponent <GM_Ball>().lastHitBy = transform.name; } } }
void OnTriggerEnter(Collider other) { FindWhoseBase(); if (other.gameObject == whoseBase && isServer) { GM_Flag flag = other.gameObject.GetComponentInChildren <GM_Flag>(); if (flag != null) { GivePoints(1); flag.CmdChangeFlagHolder(""); flag.ResetPosition(); } } }