internal static void StealTreasure(Monument stone)
    {
        Instance.Team.OnTreasureFound.Invoke(stone.Treasure);
        stone.Treasure = 0;

        SoundController.PlayStinger(SoundBank.Stinger.Sneaking);

        BigStoneView.CloseStone();

        //if (Random.value < 0.6f)
        stone.SpawnDead(Instance.Team);
    }
Exemple #2
0
    new void Awake()
    {
        base.Awake();

        Type = WindowType.LocationView;

        if (!Instance)
        {
            Instance = this;
        }

        SacFoodButton.onClick.AddListener(SacFoodBox);

        SacTreasureButton.onClick.AddListener(SacTreasureBox);

        SacGobButton.onClick.AddListener(SacGoblinBox);
        StealTreasureButton.onClick.AddListener(StealTreasureBox);
    }
    internal static void SacGoblin(Goblin goblin, Monument sacrificeStone)
    {
        Instance.Team.Members.Remove(goblin);

        SoundController.PlayStinger(SoundBank.Stinger.Sacrifice);

        LegacySystem.OnConditionEvent.Invoke(LegacySystem.UnlockCondition.GoblinSacrifice);

        goblin.Speak(SoundBank.GoblinSound.Death);

        goblin.Team = null;

        goblin.transform.parent = sacrificeStone.transform;

        goblin.tag = "Enemy";

        //goblin.CharacterRace = Character.Race.Undead;

        goblin.Health = 0;

        BigStoneView.CloseStone();
    }
    private void HandleClick(Vector3 position)
    {
        Sound.PlayMapCLick();

        //TODO Move this to a routine and insert a pause here and a shout from the Chief

        Ray        ray = Camera.main.ScreenPointToRay(position);
        RaycastHit hit;

        if (Physics.Raycast(ray, out hit, 1000, HitMask))
        {
            if (hit.collider && hit.collider.GetComponent <Lootable>())
            {
                var loot = hit.collider.GetComponent <Lootable>();

                if (loot.InArea && loot.InArea.Visible())
                {
                    Team.Leader.Search(loot);
                }
            }
            else if (hit.collider && hit.collider.GetComponent <Character>()) //TODO:check visibility else just move there
            {
                var c = hit.collider.GetComponent <Character>();
                if (c)
                {
                    //Debug.Log("Clicked charaacter " + c.name);

                    if (c.tag == "Enemy" && c.Alive())
                    {
                        if (c.InArea.Visible())
                        {
                            Team.Attack(c);
                        }
                        else
                        {
                            //ClickedArea(c.InArea);
                        }
                    }
                    else if (c as Goblin)
                    {
                        CharacterView.ShowCharacter(c as Goblin);
                        ChangeZoomLevel(ZoomLevel.GoblinView);
                    }
                    else
                    {
                        //ClickedArea(c.InArea);
                    }
                }
            }
            //TODO use parent class for these
            else if (hit.collider && hit.collider.GetComponent <GoblinWarrens>())
            {
                var v = hit.collider.GetComponent <GoblinWarrens>();

                if (v.InArea.Visible())
                {
                    VillageView.OpenVillageView(v, Team);
                }
                else
                {
                    //ClickedArea(v.InArea);
                }
            }
            //TODO use parent class for these
            else if (hit.collider && hit.collider.GetComponent <HumanSettlement>())
            {
                var v = hit.collider.GetComponent <HumanSettlement>();

                if (v.InArea.Visible())
                {
                    PlayerChoice.CreateDoChoice(() => v.AttackSettlement(), "Do you want to attack the Human " + v.Name);
                }
                //else
                //  ClickedArea(v.InArea);
            }
            //TODO: handle the point of interest click generally. Replace BigstoneView and CaveView with a Poi view?
            else if (hit.collider && hit.collider.GetComponent <Monument>())
            {
                var monument = hit.collider.GetComponent <Monument>();

                if (monument.InArea.Visible())
                {
                    BigStoneView.OpenStoneView(monument, Team);
                }
                //else
                //    ClickedArea(monument.InArea);
            }
            else if (hit.collider && hit.collider.GetComponent <Cave>())
            {
                var cave = hit.collider.GetComponent <Cave>();

                if (cave.InArea.Visible())
                {
                    CaveView.OpenCaveView(cave, Team);
                }
                //else
                //    ClickedArea(cave.InArea);
            }
            else if (hit.collider && hit.collider.GetComponent <WitchHut>())
            {
                var hut = hit.collider.GetComponent <WitchHut>();

                if (hut.InArea.Visible())
                {
                    WitchHutView.OpenWitchView(hut, Team);
                }
                //else
                //    ClickedArea(hut.InArea);
            }
            else if (hit.collider && hit.collider.GetComponent <Area>())
            {
                var a = hit.collider.GetComponent <Area>();
                //Debug.Log("Clicked Area : " + (a.name));

                //ClickedArea(a);
            }
            else
            {
                Debug.LogWarning("Not a valid hit: " + hit.point);
            }
        }
    }