public BaseObject OnToolBarClick(BaseObject obj) { Vector3 startPosition = Camera.main.ScreenToWorldPoint(Input.mousePosition); placementObject = new BaseFactory().CreateUnit(PlayerManager.humanPlayer, obj, startPosition) as BaseBuilding; PlacementEffect placementEffect = placementObject.GetComponent <PlacementEffect>(); if (placementObject.GetComponent <PlacementEffect>() == null) { placementEffect = placementObject.gameObject.AddComponent <PlacementEffect>(); } placementEffect.Setup(); return(null); //Should not be used }
virtual public void Start() { InputManager inputManager = GameObject.Find("GameControllerObject").GetComponent <InputManager>(); inputManager.RegisterListener(this); PlacementEffect teamColor = GetComponent <PlacementEffect>(); if (teamColor == null) { teamColor = gameObject.AddComponent <PlacementEffect>(); } teamColor.ApplyColorToOriginal(GetPlayer().GetTeamColor()); }