예제 #1
0
        private void OnPlaceableDead(Placeable p)
        {
            p.OnDie -= OnPlaceableDead;

            switch (p.pType)
            {
            case Placeable.PlaceableType.Unit:
            {
                Unit u = p as Unit;
                RemovePlaceableFromList(u);
                u.OnDealDamage      -= OnPlaceableDealtDamage;
                u.OnProjectileFired -= OnProjectileFired;
                uiManager.RemoveHealthUI(u);
                StartCoroutine(Dispose(u));
                break;
            }

            case Placeable.PlaceableType.Building:
            case Placeable.PlaceableType.Castle:
            {
                Building b = p as Building;
                RemovePlaceableFromList(b);
                uiManager.RemoveHealthUI(b);
                b.OnDealDamage      -= OnPlaceableDealtDamage;
                b.OnProjectileFired -= OnProjectileFired;
                StartCoroutine(RebuildNavmesh());

                if (p.pType != Placeable.PlaceableType.Castle)
                {
                    StartCoroutine(Dispose(b));
                }

                break;
            }

            case Placeable.PlaceableType.Obstacle:
            {
                StartCoroutine(RebuildNavmesh());
                break;
            }

            case Placeable.PlaceableType.Spell:
            {
                //TODO: can spells die?
                break;
            }
            }
        }
예제 #2
0
        private void OnCastleDead(Placeable c)
        {
            cinematicsManager.PlayCollapseCutscene(c.faction);
            c.OnDie -= OnCastleDead;
            gameover = true;             //stop and thinking loop

            ThinkingPlaceable thkPl;

            for (int pN = 0; pN < allThinkingPlaceables.Count; pN++)
            {
                thkPl = allThinkingPlaceables[pN];
                if (thkPl.state != ThinkingPlaceable.States.Dead)
                {
                    thkPl.Stop();
                    thkPl.transform.LookAt(c.transform.position);
                    uiManager.RemoveHealthUI(thkPl);
                }
            }

            //audioManager.GoToEndMatchSnapshot();
            cpuOpponent.StopActing();
        }