GameObject targetGameObject; // The GameObject that this editor uses #endregion Fields #region Methods void OnEnable() { this.editorSkin = (GUISkin)(Resources.LoadAssetAtPath("Assets/Editor/EditorGUISkin.guiskin", typeof(GUISkin))); this.scriptOfOurType = (ProceduralRing)target; this.targetGameObject = (GameObject)this.scriptOfOurType.gameObject; }
ProceduralRing scriptOfOurType; // The script we add the custom editor for void OnEnable() { this.editorSkin = (GUISkin)(Resources.LoadAssetAtPath("Assets/Editor/EditorGUISkin.guiskin", typeof(GUISkin))); this.scriptOfOurType = (ProceduralRing)target; this.targetGameObject = (GameObject)this.scriptOfOurType.gameObject; }
private void Start() { //caching for MagicOne magicOneParentGO = GameObject.Find("MagicOneParent"); dialOneGO = GameObject.Find("DialOne"); magicOneChildPR = GameObject.Find("MagicOneChild").GetComponent <ProceduralRing>(); offSetAngleForMagicOne = -1 * (magicOneChildPR.Angle / 2); magicOneChildMC = GameObject.Find("MagicOneChild").GetComponent <MeshCollider>(); magicOneChildMR = GameObject.Find("MagicOneChild").GetComponent <MeshRenderer>(); }
// Use this for initialization void Start() { this.proRing = GetComponent <ProceduralRing>(); this.territoryController = GetComponent <TerritoryController>(); if (Network.isServer) { this.territoryController.OnTerritoryCaptured += this.HillCapturedEvent; this.territoryController.OnTerritoryLost += this.HillLostEvent; } this.prevRadius = this.radius; this.prevHeight = this.height; // Initialize ring color if (gameObject.renderer) { gameObject.renderer.material.color = Player.TeamToColor(Player.Team.None); } this.andBoxCollider = this.andBoxColliderObject.GetComponent <BoxCollider>(); // Initilize ring size this.UpdateHillSize(); GameObject[] managerObjects = GameObject.FindGameObjectsWithTag("Manager"); if (managerObjects.Length > 0) { GameObject managerObject = managerObjects[0]; // Grab the Player Manager this.playerManager = managerObject.GetComponent <PlayerManager>(); this.scoreManager = managerObject.GetComponent <ScoreManager>(); this.gameManger = managerObject.GetComponent <GameManager>(); // Need to update the hill color if the player changes color this.playerManager.OnPlayerUpdated += this.PlayerUpdatedEvent; } }
// Use this for initialization void Start() { this.proRing = GetComponent<ProceduralRing>(); this.territoryController = GetComponent<TerritoryController>(); if(Network.isServer) { this.territoryController.OnTerritoryCaptured += this.HillCapturedEvent; this.territoryController.OnTerritoryLost += this.HillLostEvent; } this.prevRadius = this.radius; this.prevHeight = this.height; // Initialize ring color if(gameObject.renderer) gameObject.renderer.material.color = Player.TeamToColor(Player.Team.None); this.andBoxCollider = this.andBoxColliderObject.GetComponent<BoxCollider>(); // Initilize ring size this.UpdateHillSize(); GameObject[] managerObjects = GameObject.FindGameObjectsWithTag("Manager"); if(managerObjects.Length > 0) { GameObject managerObject = managerObjects[0]; // Grab the Player Manager this.playerManager = managerObject.GetComponent<PlayerManager>(); this.scoreManager = managerObject.GetComponent<ScoreManager>(); this.gameManger = managerObject.GetComponent<GameManager>(); // Need to update the hill color if the player changes color this.playerManager.OnPlayerUpdated += this.PlayerUpdatedEvent; } }