void Warp(Collider tankCollider) { WarpedBool hasWarped = tankCollider.GetComponent <WarpedBool> (); if (!hasWarped.GetWarped()) { Transform tankTransform = tankCollider.gameObject.transform.parent.transform; Instantiate(m_GhostPrefab, tankTransform.position, tankTransform.rotation); Vector3 positionOffset = tankTransform.position - m_Transform.position; positionOffset = Quaternion.AngleAxis(90f, m_Transform.up) * positionOffset; tankTransform.position = m_LinkedTransform.position + positionOffset; tankTransform.RotateAround(tankTransform.position, m_Transform.up, 90f); tankTransform.position += m_Transform.up; hasWarped.SetWarped(true); Glow(); m_LinkedPortal.Glow(); m_CameraControl.SetCubeSide(m_LinkedPortal.m_CubeSide); } }
void WarpAI(Collider tankCollider) { WarpedBool hasWarped = tankCollider.GetComponent <WarpedBool> (); if (!hasWarped.GetWarped()) { Transform tankTransform = tankCollider.gameObject.transform.parent.transform; Instantiate(m_GhostPrefab, tankTransform.position, tankTransform.rotation); NavMeshAgent tankAgent = tankCollider.gameObject.transform.parent.GetComponent <NavMeshAgent> (); StateController tempController = tankCollider.gameObject.transform.parent.GetComponent <StateController> (); tempController.SetCubeSide(m_LinkedPortal.m_CubeSide); Vector3 newPosition = tankTransform.position - m_Transform.position; newPosition = Quaternion.AngleAxis(90f, m_Transform.up) * newPosition; newPosition = newPosition + m_LinkedTransform.position + m_Transform.up; tankAgent.Warp(newPosition); tankTransform.RotateAround(tankTransform.position, m_Transform.up, 90f); hasWarped.SetWarped(true); Glow(); m_LinkedPortal.Glow(); } }
void Warp(Collider tankCollider) { WarpedBool hasWarped = tankCollider.GetComponent <WarpedBool> (); if (!hasWarped.GetWarped()) { Transform tankTransform = tankCollider.gameObject.transform.parent.transform; Vector3 positionOffset = tankTransform.position - m_Transform.position; positionOffset = Quaternion.AngleAxis(90f, m_Transform.up) * positionOffset; tankTransform.position = m_LinkedTransform.position + positionOffset; tankTransform.RotateAround(tankTransform.position, m_Transform.up, 90f); tankTransform.position += m_Transform.up; hasWarped.SetWarped(true); SetCubeTarget(m_LinkedPortal.m_CubeSide.m_RotateVector); Glow(); m_LinkedPortal.Glow(); } }