private void SynchroniseEntitiesPosition() { if (Network.isServer) { if (nextPositionUpdate <= 0f) { nextPositionUpdate += positionUpdateFrequency; Component[] componentList = pkmn.GetComponentsInChildren(typeof(PokemonController)); foreach (Component comp in componentList) { PokemonController cont = (PokemonController)comp; if (cont.transform.parent.gameObject != pkmn) { continue; } cont.GetComponent <NetworkView>().RPC("WarpEntity", RPCMode.OthersBuffered, cont.GetComponent <NetworkView>().viewID, cont.transform.position, cont.nav.speed, cont.transform.rotation, cont.nav.destination); } } else { nextPositionUpdate -= Time.deltaTime; } } }
void HightlightEntities() { GameObject caster = controller.gameObject; EntityManager em = controller.GetComponent <EntityManager>(); SphereCollider[] colliderList = entityList.GetComponentsInChildren <SphereCollider>(); foreach (SphereCollider collider in colliderList) { if (!collider.gameObject.activeSelf) { continue; } Color outlineColor = Color.black; /*if(hoverEntity == pkmn.gameObject) * outlineColor = Color.white;*/ if (selectedMove != null && !selectedMove.IsLaunched()) { float range = selectedMove.info.Range; //SphereCollider pkmnCollider = (SphereCollider)pkmn.GetComponent(typeof(Collider)); if (Vector3.Magnitude(collider.transform.position - caster.transform.position) <= selectedMove.info.Range / 100f + controller.nav.radius + collider.radius) { if (((int)em.GetRelation(collider.gameObject) & (int)selectedMove.info.AllowedTargets) != 0) { outlineColor = Color.white; if (selectedMove.info.TargetKind == MoveTargetKind.Single && hoverEntity == collider.gameObject) { outlineColor = Color.red; } } } } Renderer rend = (Renderer)collider.GetComponentInChildren(typeof(Renderer)); foreach (Material mat in rend.materials) { mat.SetColor("_OutlineColor", outlineColor); } } }