private void ResolveCard() { this.endTargeting(); bool draw = false; Debug.Log("Resolving " + currentCard.name + " on target: " + (currentTargetType == TargetType.None ? "None" : guestTarget.guest.name)); // This is horrific and I would absolutely NEVER do this in production. But, y'know, game jam. switch (currentCard.name) { case "Wine": { int targetIndex = guests.GetGuestIndexByName(guestTarget.guest.name); guests.guests[targetIndex].status = Status.Wine; break; } case "Hypnotize": { int targetIndex = guests.GetGuestIndexByName(guestTarget.guest.name); guests.guests[targetIndex].suspicion = (int)Mathf.Max(guests.guests[targetIndex].suspicion - 2, 0); // meter.UpdateSuspicion(this); TODO break; } case "Bad Directions": { Room newRoom = BoardManager.Instance.GetRandomAvailableRoom(guestTarget.guest, true); guestTarget.guest.currentRoom.RemoveGuest(guestTarget.guest); newRoom.AddGuest(guestTarget); break; } case "Silence": { roomTarget.silent = true; break; } case "Seduce": { int targetIndex = guests.GetGuestIndexByName(guestTarget.guest.name); guests.guests[targetIndex].status = Status.Seduced; break; } case "Change of Plans": { draw = true; break; } default: Debug.Log("This card does not exist: " + currentCard.name); break; } // Remove card from hand deck.Discard(currentCardIndex, draw); currentCard = null; currentTargetType = TargetType.None; guestTarget = null; roomTarget = null; SetPhase(Phase.Play); }
private void OnPhaseChange(Phase newPhase, Phase prevPhase) { // Set all rooms if (newPhase == Phase.Setup) { // Remove all guests from all rooms foreach (Room r in rooms) { r.Clear(); } for (int i = 0; i < guestList.guests.Count; i++) { Guest g = guestList.guests[i]; if (g.isAlive) { GuestPiece gp = guestList.pieces[g.name]; // Pick a random room Room r = GetRandomAvailableRoom(g); r.AddGuest(gp); } } GameManager.Instance.GuestAssignmentDone(); } }
private void OnGuestKilled(Guest victim) { foreach (Guest g in guests) { if (g.name == victim.name) { g.isAlive = false; GuestPiece gp = pieces[g.name]; gp.guest.currentRoom.RemoveGuest(g); gp.transform.position = piecesLocation.position; } } }
void Awake() { // Initialize deathList for (int i = 0; i < guests.Count; i++) { deathList[guests[i].name] = false; // Create game piece for this guest Vector3 spawn = piecesLocation.position + new Vector3(i, 0f, 0f); GuestPiece gp = Instantiate(piecePrefab, spawn, Quaternion.identity).GetComponent <GuestPiece>(); gp.SetGuest(guests[i]); pieces[guests[i].name] = gp; } }
// Called by a Room or Guest when targeted by a card public void SetTarget(GameObject obj) { if (killing) { endTargeting(); killing = false; this.KillGuest(obj.GetComponent <GuestPiece>().guest); } else { if (currentTargetType == TargetType.Guest) { this.guestTarget = obj.GetComponent <GuestPiece>(); } else if (currentTargetType == TargetType.Room) { this.roomTarget = obj.GetComponent <Room>(); } ResolveCard(); } }
public void AddGuest(GuestPiece gp) { guests.Add(gp.guest); gp.guest.currentRoom = gameObject.GetComponent <Room>(); gp.transform.position = getNextFreeLocation().position; }