public UILaunchControl Init(LauncherControl newLauncher) { handleRenderer = transform.GetComponent <Renderer>(); connector = transform.parent.Find("LauncherBar"); connectorRenderer = connector.GetComponent <Renderer>(); launcher = newLauncher; returnCurve = launcher.handleReturnCurve; isSetup = true; Color lastShotColor = launcher.PlayerColor; lastShotColor.a = 0.75f; lastShotHandle = transform.parent.Find("LastShotHandle"); lastShotHandle.GetComponent <Renderer>().material.color = lastShotColor; lastShotHandle.gameObject.SetActive(false); lastShotConnector = transform.parent.Find("LastShotConnector"); lastShotConnectorRenderer = lastShotConnector.GetComponent <Renderer>(); lastShotConnectorRenderer.material.color = lastShotColor; lastShotConnector.gameObject.SetActive(false); coolDownMeter = transform.parent.Find("CoolDownMeter"); coolDownRenderer = coolDownMeter.GetComponent <Renderer>(); coolDownRenderer.material.SetColor("_Color", launcher.PlayerColor); SphereCollider handleColl = gameObject.AddComponent <SphereCollider>(); handleColl.radius = 0.5f; return(this); }
void AddLauncher() { GameObject launcherObj = Instantiate(gameManager.launcherPrefab, transform); launcherObj.tag = isPlayerIsland ? "Player" : "Enemy"; launcherObj.transform.position = gameBoard.StartPose.position; launcherObj.transform.rotation = gameBoard.StartPose.rotation; launcherObj.transform.localScale = Vector3.one * CubeSize; launcher = launcherObj.GetComponent <LauncherControl>(); launcher.Init(playerName, this); gameManager.AddLauncher(Launcher); }
public LauncherShot(string name, LauncherControl owner, Vector3 startPos, Vector3 velocity) { this._name = name; this._owner = owner; this._ownerName = _owner.PlayerName; this._startPos = startPos; this._velocity = velocity; HasDebris = UnityEngine.Random.value < 0.6f; DebrisName = "debris" + Mathf.FloorToInt(UnityEngine.Random.value * 100000).ToString(); DebrisOffset = new Vector3( UnityEngine.Random.Range(-0.1f, 0.1f), UnityEngine.Random.Range(0.5f, 0.7f), UnityEngine.Random.Range(0.0f, 0.3f)); }
public void AddLauncher(LauncherControl newLauncher) { multiplayer.AddPlayerLauncher(localID, newLauncher.transform.localPosition, newLauncher.transform.localEulerAngles); if (newLauncher.gameObject.tag.Equals("Player")) { localLauncher = newLauncher; } else { Debug.Log("Adding setting listner for " + newLauncher.name); multiplayer.AddLauncherListener(newLauncher.PlayerName, newLauncher.GetNetworkUpdate); remoteLauncher = newLauncher; remoteID = newLauncher.PlayerName; } }
void Start() { launcherControl = GameObject.Find("Launchers").GetComponent <LauncherControl>(); buildingControl = GameObject.Find("Buildings").GetComponent <BuildingControl>(); StartGame(); }