private void SelectingShipUpdate() { if (playerRef.GetButtonDown("Left")) { currentlySelectedShip--; if ((int)currentlySelectedShip < 0) { currentlySelectedShip = (CastleShip.CastleShipType) 2; } onShipChanged(battleManagerRef.GetShip(currentlySelectedShip)); } else if (playerRef.GetButtonDown("Right")) { currentlySelectedShip++; if ((int)currentlySelectedShip >= 3) { currentlySelectedShip = 0; } onShipChanged(battleManagerRef.GetShip(currentlySelectedShip)); } else if (playerRef.GetButtonDown("Accept")) { ChangeToPlaying(); } }
private void AddShip(CastleShip.CastleShipType castleShipType, bool ai = false) { if (CastleShip != null) { RemoveShip(); } castleShip = battleManagerRef.SpawnShip(castleShipType, this.BoundPlayerID, this.spawnPosition, ai); CastleShip.OnGoldChanged += AddGold; CastleShip.OnKill += AddKill; CastleShip.SetColourMaterial(this.playerColour); playerUIManager.ConnectToCastleShip(CastleShip); CastleShip.DamageableRef.OnDeath.AddListener(OnShipDie); }
public CastleShip SpawnShip(CastleShip.CastleShipType shipType, int playerId, Transform spawnTransform, bool ai = false) { GameObject newShip = ai ? Instantiate(AIShipDict[shipType], spawnTransform) : Instantiate(ShipDict[shipType], spawnTransform); newShip.transform.position = spawnTransform.position; newShip.transform.rotation = spawnTransform.rotation; if (!ai) { newShip.GetComponent <PlayerControlled>().AssignPlayer(playerId); } targetGroup.AddMember(newShip.transform, 1.0f, 3.0f); return(newShip.GetComponent <CastleShip>()); }
public CastleShip GetShip(CastleShip.CastleShipType shipType) { return(ShipDict[shipType].GetComponent <CastleShip>()); }