void Start() { gameMaster = GameObject.Find("GameMaster").GetComponent <GameMaster>(); player = GameObject.Find("Corvette (player)"); //bad core = GetComponent <ShipCore>(); turret = transform.Find("Ship Pivot").Find("Corvette Body").Find("Corvette Turret").GetComponent <ShipTurret>(); //bad shipPivot = transform.Find("Ship Pivot").gameObject; //bad }
private void Start() { core = GetComponent <ShipCore>(); turret = transform.Find("Ship Pivot").Find("Ship Body").Find("Turret Base").Find("Turret Horizontal").GetComponent <ShipTurret>(); missileLauncher = transform.Find("Ship Pivot").Find("Ship Body").Find("MissileLauncher").GetComponent <MissileLauncher>(); cameraPivot = transform.Find("Camera Pivot").gameObject; mainCamera = cameraPivot.transform.Find("Ship Camera").GetComponent <Camera>(); GlobalVars.globalGameObjects.TryGetValue("hud", out hud); crosshair = hud.transform.Find("Crosshair").GetComponent <Image>(); }
protected override void Start() { base.Start(); Alive = true; m_Core = transform.GetComponentInParent<ShipCore>(); if (m_Core == null) { m_Core = ExternalCore; } }
public void ConnectToShip(ShipCore ship) { Debug.Log($"connecting {name} to ship"); connectedShip = ship; factionId = ship.FactionId; foreach (var connection in connections) { connection.gameObject.SetActive(true); connection.Ship = ship; } damagable.FactionId = factionId; rb2D.isKinematic = true; OnShipConnected(); }
public void CreatePlayer(AControlDevice new_player_device) { GameObject new_player = Instantiate(player_prefab, Vector3.zero, Quaternion.identity, null); PlayerIdentity identity = new_player.GetComponent <PlayerIdentity>(); identity.Configure(0, new_player_device, Color.blue); GameObject new_ship = Instantiate( ship_prefab, Vector3.zero, Quaternion.identity, new_player.transform ); ShipCore core = new_ship.GetComponent <ShipCore>(); core.BoardPlayer(identity); // enabled systems. // TODO: put this somewhere else. core.Mount(Item.ion_drive); }
public override void LoadContent(GameData data) { //hall EntList.Add(new CaveFloor(new Vector2(0, -hallHeightHalf), new Vector2(hallWidth, hallHeight))); EntList.Add(new CaveWall(new Vector2(-hallWidthHalf - wallWidthHalf, -hallHeightHalf), new Vector2(hallHeight, wallWidth), MathHelper.PiOver2)); EntList.Add(new CaveWall(new Vector2(hallWidthHalf + wallWidthHalf, -hallHeightHalf), new Vector2(hallHeight, wallWidth), 3 * MathHelper.PiOver2)); AreaChangeTriggers.Add(new TriggerChangeArea(new Vector2(0, -hallHeight - hallWidthHalf), new Vector2(hallWidthHalf, hallWidthHalf), new AreaMars())); //room EntList.Add(new CaveFloor(new Vector2(0, roomHeightHalf), new Vector2(roomWidth, roomHeight))); EntList.Add(new CaveWall(new Vector2(0, roomHeight + wallWidthHalf), new Vector2(roomWidth + 2 * wallWidth, wallWidth), 0)); EntList.Add(new CaveWall(new Vector2(-roomWidthHalf - wallWidthHalf, roomHeightHalf), new Vector2(roomHeight, wallWidth), MathHelper.PiOver2)); EntList.Add(new CaveWall(new Vector2(roomWidthHalf + wallWidthHalf, roomHeightHalf), new Vector2(roomHeight, wallWidth), 3 * MathHelper.PiOver2)); const float bottomWallSize = roomWidthHalf - hallWidthHalf; const float bottomWallX = roomWidthHalf + wallWidth - (bottomWallSize / 2); const float midWallSize = roomWidthHalf - doorWidthHalf; const float midWallX = roomWidthHalf - (midWallSize / 2); EntList.Add(new CaveWall(new Vector2(-bottomWallX, -wallWidthHalf), new Vector2(bottomWallSize, wallWidth), MathHelper.Pi)); EntList.Add(new CaveWall(new Vector2(bottomWallX, -wallWidthHalf), new Vector2(bottomWallSize, wallWidth), MathHelper.Pi)); EntList.Add(new CaveWall(new Vector2(-midWallX, roomHeightHalf), new Vector2(midWallSize, 3 * wallWidth), 0)); EntList.Add(new CaveWall(new Vector2(midWallX, roomHeightHalf), new Vector2(midWallSize, 3 * wallWidth), 0)); //doors Door d1 = new Door(new Vector2(0, roomHeightHalf - wallWidth), 0); Door d2 = new Door(new Vector2(0, roomHeightHalf), 0); Door d3 = new Door(new Vector2(0, roomHeightHalf + wallWidth), 0); d2.Visible = false; d2.Solid = false; d3.Visible = false; d3.Solid = false; EntList.Add(d1); EntList.Add(d2); EntList.Add(d3); Button b1 = new Button(new Vector2(-roomWidthHalf + 8 + 32, 19 + 32)); Button b2 = new Button(b1.Position + new Vector2(0, 64 + 19)); Button b3 = new Button(b2.Position + new Vector2(0, 64 + 19)); Button b4 = new Button(new Vector2(-b3.Position.X, b3.Position.Y)); EntList.Add(b1); EntList.Add(b2); EntList.Add(b3); EntList.Add(b4); TriggerButtonPress bp1 = new TriggerButtonPress(b1.Position, b1.Size, b1, d2, d3); TriggerButtonPress bp2 = new TriggerButtonPress(b2.Position, b2.Size, b2, d1, d2); TriggerButtonPress bp3 = new TriggerButtonPress(b3.Position, b3.Size, b3, d1, d3); TriggerButtonPress bp4 = new TriggerButtonPress(b4.Position, b4.Size, b4, d1, d2, d3); ButtonPressTriggers.Add(bp1); ButtonPressTriggers.Add(bp2); ButtonPressTriggers.Add(bp3); ButtonPressTriggers.Add(bp4); if (!data.CoreFound) { ShipCore core = new ShipCore(new Vector2(0, roomHeight - 96)); PickupTriggers.Add(new TriggerPickup(core.Position, core.Size + new Vector2(16, 16), core)); EntList.Add(core); } Note n = new Note(new Vector2(-b1.Position.X, b1.Position.Y)); EntList.Add(n); ReadingTriggers.Add(new TriggerReading(n.Position, new Vector2(64, 64), Notes.CaveNote)); Resources.StopAllAudio(); Resources.Audio["shipStaticLoop.wav"].Play(); }
void Start() { m_Focus = GameObject.FindGameObjectWithTag("PlayerBattle").transform; m_Stats = m_Focus.GetComponent<ShipCore>(); }
protected virtual void Awake() { core = GetComponentInParent <ShipCore>(); Assert.IsNotNull(core); ship = core.gameObject; }
void Start() { m_Stats = GetComponent<ShipCore> (); m_Body = GetComponent<Rigidbody> (); }
void Start() { m_TargetingComputer = gameObject.GetComponent<TargetingComputer>(); m_Core = gameObject.GetComponent<ShipCore>(); m_BattleMovement = gameObject.GetComponent<BattleMovement>(); m_CoreCollider = gameObject.GetComponentsInChildren<Collider>(); m_CastOffset = GetLengthOfShip(); StatRandomiser(MaxVariation, MinVariation); m_DangerDistance = m_Core.MaxSpeed * Caution; }
private void Start() { playing = false; if (gameMaster != null) { playerNumber = gameMaster.AddPlayer(gameObject); gameMasterActive = true; } else if (isLocalPlayer && isServer) { NetworkServer.SpawnWithClientAuthority(Instantiate(gameMasterPrefab, Vector3.zero, Quaternion.identity), connectionToClient); } //Debug.Log(0); ResetHealth(); if (isLocalPlayer) { // Generate a name for the player CmdSetPlayerName(namePool[Random.Range(0, namePool.Length)] + "_" + Random.Range(0, 99)); GlobalVars.globalGameObjects.TryGetValue("hud", out hud); healthUI = hud.transform.Find("Health UI").GetComponent <Text>(); //Debug.Log(1); } if (isLocalPlayer && isServer) { //Debug.Log(2); icebergMaster = Instantiate(icebergMasterPrefab, Vector3.zero, Quaternion.identity); NetworkServer.SpawnWithClientAuthority(icebergMaster, connectionToClient); //GameObject.Find("Multiplayer_Manager").GetComponent<NetworkManager>().customConfig = true; //GameObject.Find("Multiplayer_Manager").GetComponent<NetworkManager>().connectionConfig.MaxCombinedReliableMessageSize = 248; //GameObject.Find("Multiplayer_Manager").GetComponent<NetworkManager>().connectionConfig.MaxCombinedReliableMessageCount = 248; //GameObject.Find("Multiplayer_Manager").GetComponent<NetworkManager>().connectionConfig.MaxSentMessageQueueSize = 248; //setting cache here if (globalGameObjects.TryGetValue("multiplayer_manager", out gameObjectCache)) { gameObjectCache.GetComponent <NetworkManager>().customConfig = true; gameObjectCache.GetComponent <NetworkManager>().connectionConfig.MaxCombinedReliableMessageSize = 248; gameObjectCache.GetComponent <NetworkManager>().connectionConfig.MaxCombinedReliableMessageCount = 248; gameObjectCache.GetComponent <NetworkManager>().connectionConfig.MaxSentMessageQueueSize = 248; } else { Debug.LogError("Could not find Multiplayer Manager"); } //NetworkServer.Configure(Network.ConnectionConfig) } //Debug.Log(3); kaijuCore = playerObjects[0].GetComponent <KaijuCore>(); shipCore = playerObjects[1].GetComponent <ShipCore>(); shipTurret = playerObjects[1].transform.Find("Ship Pivot/Ship Body/Turret Base/Turret Horizontal").GetComponent <ShipTurret>(); kaijuController = playerObjects[0].GetComponent <PlayerKaijuController>(); shipController = playerObjects[1].GetComponent <PlayerShipController>(); Debug.Log(playerObjects[1]); Debug.Log(shipController); //Debug.Log(4); isKaiju = false; globalGameObjects.TryGetValue("kaiju_tracker", out kaijuTracker); if (isLocalPlayer) { GlobalVars.globalGameObjects.TryGetValue("starting_camera", out startingCamera); GlobalVars.globalGameObjects.TryGetValue("ocean", out ocean); } }