Example #1
0
    public void MakePopupPanel()
    {
        if (!game.IsLocalPlayersTurn())
        {
            return;
        }

        PopupManager popup = PopupManager.Instance;

        //This is going off the assumption that we currently only have one player at a time
        FireMan fireman = game.GetLocalFireman();

        if (GetStatus() == DoorStatus.OPEN)
        {
            int    cost = fireman.determineCost(ActionType.TOGGLE_DOOR);
            string msg  = string.Format("Close Door: {0} AP", cost);
            popup.AddButton(msg, delegate { fireman.ToggleDoor(this); });
        }
        else if (GetStatus() == DoorStatus.CLOSED)
        {
            int    cost = fireman.determineCost(ActionType.TOGGLE_DOOR);
            string msg  = string.Format("Open Door: {0} AP", cost);
            popup.AddButton(msg, delegate { fireman.ToggleDoor(this); });
        }
        Vector2 position = gameObject.GetComponent <RectTransform>().anchoredPosition;

        //bad Sarah
        Vector3 rotation = gameObject.GetComponent <RectTransform>().rotation.eulerAngles;

        //if the edge is vertical, offset the popup by less
        if (rotation.Equals(Vector3.zero))
        {
            position.x += 160;
        }
        else
        {
            position.x += 320;
        }

        popup.SetPositionAndShow(position);
    }
Example #2
0
    public void MakePopupPanel()
    {
        if (!game.IsLocalPlayersTurn())
        {
            return;
        }

        PopupManager popup    = PopupManager.Instance;
        Vector2      position = GetTransform().anchoredPosition;

        position.x += 160 + 150;
        position.y += 840 + 10;

        //This is going off the assumption that we currently only have one player at a time
        FireMan fireman = game.GetLocalFireman();

        if (fireman == null)
        {
            Debug.Log("fireman is null!");
        }

        if (game.status == GameStatus.MAIN_GAME)
        {
            foreach (POI poi in pois)
            {
                if (poi.GetStatus() == POIstatus.REVEALED && typeof(Victim).IsInstanceOfType(poi) && fireman.GetVictim() == null && fireman.GetLocation() == this)
                {
                    popup.AddButton("Pickup Victim: 0 AP", delegate { fireman.Pickup((Victim)pois[0]); });
                }
            }

            if (fireman.GetVictim() != null && fireman.GetLocation() == this)
            {
                popup.AddButton("Drop Victim: 0 AP", delegate { fireman.Drop(); });
            }

            if (this.status == CellStatus.FIRE)
            {
                int    cost1 = fireman.determineCost(ActionType.EXTINGUISH);
                string msg1  = string.Format("Putout Fire: {0} AP", cost1);
                popup.AddButton(msg1, delegate { fireman.ExtinguishFire(this); });
            }

            else
            {
                int    cost = game.PathFinder(this);
                string msg  = string.Format("Move: {0} AP", cost);
                popup.AddButton(msg, delegate { fireman.Move(this); });
            }

            if (this.status == CellStatus.SMOKE)
            {
                int    cost1 = fireman.determineCost(ActionType.EXTINGUISH);
                string msg1  = string.Format("Putout Smoke: {0} AP", cost1);
                popup.AddButton(msg1, delegate { fireman.ExtinguishFire(this); });
            }

            popup.SetPositionAndShow(position);
        }
        else if (game.status == GameStatus.SETUP)
        {
            if (this.kind == CellKind.OUTDOOR)
            {
                popup.AddButton("Select Starting Space", delegate { game.SetFiremanStartingSpace(fireman, this); });
                popup.SetPositionAndShow(position);
            }
            else
            {
                Debug.Log("Please pick an outdoor cell");
            }
        }
    }