Beispiel #1
0
    void Loading()
    {
        // Get the BattleRoot Object
        if (battleRoot == null)
        {
            battleRoot = GameObject.FindObjectOfType <BattleRootController>();
        }
        if (FCTInterface == null)
        {
            FCTInterface = (FloatingCombatTextInterface)MenuManager.Instance.Load("Interface_FloatingCombatText");
        }
        if (battleInterface == null)
        {
            battleInterface = (BossBattleInterface)MenuManager.Instance.Push("Interface_BossBattle");
        }
        if ((selector == null) && (battleRoot != null))
        {
            selector = (ActorSelector)battleRoot.GetSelector();
        }

        data = playerMan.SelectedBattle;

        playerMan.CurrentLeaderSkill = data.Party[0].data.LeadershipSkill;

        // If the battleRoot object isn't null goto the next phase
        if (battleRoot != null /* && battleInterface != null*/)
        {
            Phase++;
        }
    }
 void OnTriggerExit(Collider other)
 {
     if (other.tag == "NPC")
     {
         startConversation = false;
         conversationWith  = null;
     }
 }
 void OnTriggerEnter(Collider other)
 {
     if (other.tag == "NPC")
     {
         startConversation = true;
         conversationWith  = other.gameObject.GetComponent <ActorSelector>();
     }
 }
Beispiel #4
0
        public ExplorerAgent(AIController ai, AssistAgent assist, String name) : base(ai, name)
        {
            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent <FOWEntity>().IsOwnedByPlayer,
                fireCondition     = gameObject => true
            };

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            // Setup difficulty levels
            switch (ai.DifficultyLvl)
            {
            case 0:
                isEnabled = false;
                break;

            case 1:
                RescheduleSightRange              = 0;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 1;
                break;

            case 2:
                RescheduleSightRange              = 15;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 2;
                break;

            case 3:
            default:
                RescheduleSightRange              = 30;
                ReschuduleDiceFaces               = 1000;
                RescheduleRandomPointValue        = 1000;
                RescheduleRandomAroundTargetValue = 990;
                RescheduleRandomDirectionValue    = 970;
                MaxExplorerSquads = 2;
                break;
            }


            heroVisible = false;
            terrain     = Terrain.activeTerrain;
            fowManager  = FOWManager.Instance;
            heroLastPos = Vector3.zero;
            assistAgent = assist;
        }
Beispiel #5
0
        public override void Start()
        {
            base.Start();
            DifficultyLvl = info.Difficulty;
            _selfRace     = info.GetPlayerRace() == Races.MEN ? Races.ELVES : Races.MEN;

            //Init lists
            EnemyUnits     = new List <Unit>();
            EnemyBuildings = new List <IGameEntity>();
            OwnResources   = new List <Resource>();
            OwnBarracks    = new List <Barrack>();
            modules        = new List <AIModule>();
            Army           = new List <Unit>();
            Workers        = new List <Unit>();

            Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
            SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
            Battle.PlayableEntity.EntityPosition pos = me.GetBuildings()[0].position;
            rootBasePosition = new Vector3(pos.X, 80, pos.Y);
            buildPosition    = rootBasePosition;
            Macro            = new MacroManager(this);
            StoryMode        = Macro.architect.constructionGrid.mode != AIMode.BATTLE;
            Micro            = new MicroManager(this);
            modules.Add(new AIModule(Macro.MacroHigh, !StoryMode ? (39 - DifficultyLvl * 3) : 1));
            modules.Add(new AIModule(Macro.MacroLow, 8 - DifficultyLvl));
            modules.Add(new AIModule(Micro.Micro, 4 - DifficultyLvl));
            timers        = new float[modules.Count];
            hasStronghold = true;
            for (int i = 0; i < modules.Count; i++)
            {
                timers[i] = 0;
            }

            InstantiateBuildings(me.GetBuildings());
            InstantiateUnits(me.GetUnits());

            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent <FOWEntity>().IsOwnedByPlayer,
                fireCondition     = gameObject => true
            };

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

            Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            if (AI_DEBUG_ENABLED)
            {
                aiDebug = AIDebugSystem.CreateComponent(gameObject, this);
            }

            missionStatus = new MissionStatus(playerId);
        }
Beispiel #6
0
		public ExplorerAgent(AIController ai, AssistAgent assist, String name) : base(ai, name)
        {
            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent<FOWEntity>().IsOwnedByPlayer,
                fireCondition = gameObject => true
            };
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            // Setup difficulty levels
            switch (ai.DifficultyLvl)
            {
                case 0:
                    isEnabled = false;
                    break;

                case 1:
                    RescheduleSightRange = 0;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 1;
                    break;

                case 2:
                    RescheduleSightRange = 15;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 2;
                    break;
                    
                case 3:
                default:
                    RescheduleSightRange = 30;
                    ReschuduleDiceFaces = 1000;
                    RescheduleRandomPointValue = 1000;
                    RescheduleRandomAroundTargetValue = 990;
                    RescheduleRandomDirectionValue = 970;
                    MaxExplorerSquads = 2;
                    break;
            }
            

            heroVisible = false;
            terrain = Terrain.activeTerrain;
            fowManager = FOWManager.Instance;
            heroLastPos = Vector3.zero;
            assistAgent = assist;
        }
Beispiel #7
0
        public override void Start()
        {
            base.Start();
            DifficultyLvl = info.Difficulty;
            _selfRace = info.GetPlayerRace() == Races.MEN ? Races.ELVES : Races.MEN;

            //Init lists
            EnemyUnits = new List<Unit>();
            EnemyBuildings = new List<IGameEntity>();
            OwnResources = new List<Resource>();
            OwnBarracks = new List<Barrack>();
            modules = new List<AIModule>();
            Army = new List<Unit>();
            Workers = new List<Unit>();

            Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
            SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
            Battle.PlayableEntity.EntityPosition pos = me.GetBuildings()[0].position;
            rootBasePosition = new Vector3(pos.X, 80, pos.Y);
            buildPosition = rootBasePosition;
            Macro = new MacroManager(this);
            StoryMode = Macro.architect.constructionGrid.mode != AIMode.BATTLE;
            Micro = new MicroManager(this);
            modules.Add(new AIModule(Macro.MacroHigh, !StoryMode ? (39 - DifficultyLvl*3) : 1));
            modules.Add(new AIModule(Macro.MacroLow, 8 - DifficultyLvl));
            modules.Add(new AIModule(Micro.Micro,  4 - DifficultyLvl));
            timers = new float[modules.Count];
            hasStronghold = true;
            for (int i = 0; i < modules.Count; i++)
                timers[i] = 0;

            InstantiateBuildings(me.GetBuildings());
            InstantiateUnits(me.GetUnits());

            ActorSelector selector = new ActorSelector()
            {
                registerCondition = gameObject => gameObject.GetComponent<FOWEntity>().IsOwnedByPlayer,
                fireCondition = gameObject => true
            };
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);
            Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.HIDDEN, OnEntityLost, selector);

            if (AI_DEBUG_ENABLED)
            {
                aiDebug = AIDebugSystem.CreateComponent(gameObject, this);
            }

            missionStatus = new MissionStatus(playerId);
        }
        // GET: Movie/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Movie movie = db.Movie.Find(id);

            if (movie == null)
            {
                return(HttpNotFound());
            }
            ViewBag.DirectorId = new SelectList(db.Director, "Id", "Name", movie.DirectorId);
            ViewBag.MediaId    = new SelectList(db.RelatedMedia, "Id", "MediaLink", movie.MediaId);

            MovieVM moviesvm = new MovieVM();

            moviesvm.Id          = id.Value;
            moviesvm.Title       = movie.Title;
            moviesvm.DirectorId  = movie.DirectorId;
            moviesvm.MediaId     = movie.MediaId;
            moviesvm.Rank        = movie.Rank;
            moviesvm.ReleaseDate = movie.ReleaseDate;

            List <ActorSelector> actorselectorvm = new List <ActorSelector>();

            var result = from a in db.Actor
                         select new
            {
                a.Id,
                a.Name,
                Selected = ((from m in db.MovieActors
                             where m.ActorId == a.Id && m.MovieId == id
                             select m).Count() > 0)
            };

            foreach (var item in result)
            {
                ActorSelector asel = new ActorSelector();
                asel.Id       = item.Id;
                asel.Name     = item.Name;
                asel.Selected = item.Selected;
                asel.Name     = asel.Name;
                actorselectorvm.Add(asel);
            }

            moviesvm.ActorSelector = actorselectorvm;
            return(View(moviesvm));
        }
Beispiel #9
0
        public void registerForAll(T action, Action <Object> func, ActorSelector selector)
        {
            callbacks[action].Add(func);
            SelectorStore <T> .get._selectors[action].Add(func, selector);

            // Find all already existing gameobjects of this type
            UnityEngine.Object[] alreadyExistingActors = UnityEngine.Object.FindObjectsOfType(typeof(SubscribableActor <T, S>));
            foreach (UnityEngine.Object obj in alreadyExistingActors)
            {
                var actor = (SubscribableActor <T, S>)obj;

                if (selector.registerCondition(actor.gameObject))
                {
                    actor.register(action, func);
                }
            }
        }
        // GET: Movie/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Movie movie = db.Movie.Find(id);

            if (movie == null)
            {
                return(HttpNotFound());
            }

            MovieVM moviesvm = new MovieVM();

            moviesvm.Id          = id.Value;
            moviesvm.Title       = movie.Title;
            moviesvm.DirectorId  = movie.DirectorId;
            moviesvm.MediaId     = movie.MediaId;
            moviesvm.Rank        = movie.Rank;
            moviesvm.ReleaseDate = movie.ReleaseDate;

            List <ActorSelector> actorselectorvm = new List <ActorSelector>();

            var result = from a in db.Actor
                         where
                         (from m in db.MovieActors
                          where m.ActorId == a.Id && m.MovieId == id
                          select m.ActorId).Contains(a.Id)

                         select a;

            foreach (var item in result)
            {
                ActorSelector asel = new ActorSelector();
                asel.Id   = item.Id;
                asel.Name = item.Name;
                actorselectorvm.Add(asel);
            }

            moviesvm.ActorSelector = actorselectorvm;

            return(View(moviesvm));
        }
Beispiel #11
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent<Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam = GameObject.FindWithTag("MainCamera").GetComponent<CameraController>();
        events = GetComponent<EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();
        
        missionStatus = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance = 100;
        minWoodTolerance = 500;
        minMetalTolerance = 500;
        minGoldTolerance = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent<FOWEntity>().IsOwnedByPlayer),
            fireCondition = (g) => true
        };
        Utils.Subscriber<FOWEntity.Actions, FOWEntity>.get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;

    }
Beispiel #12
0
    // Use this for initialization
    public override void Start()
    {
        base.Start();
        _selection = GetComponent <Managers.SelectionManager>();
        //request the race of the player
        _selfRace = info.GetPlayerRace();
        _selection.SetRace(race);

        cam    = GameObject.FindWithTag("MainCamera").GetComponent <CameraController>();
        events = GetComponent <EventsNotifier>();

        Battle.PlayerInformation me = info.GetBattle().GetPlayerInformationList()[playerId - 1];
        InstantiateBuildings(me.GetBuildings());
        InstantiateUnits(me.GetUnits());
        SetInitialResources(me.GetResources().Wood, me.GetResources().Food, me.GetResources().Metal, me.GetResources().Gold);
        // gameObject.AddComponent<ResourcesPlacer>();

        missionStatus    = new MissionStatus(playerId);
        _resourcesPlacer = ResourcesPlacer.get(this); // initialization

        // TODO Set this values dynamically
        minFoodTolerance  = 100;
        minWoodTolerance  = 500;
        minMetalTolerance = 500;
        minGoldTolerance  = 500;

        foodDepleted = _resourcesPlacer.Amount(WorldResources.Type.FOOD) <= 0;

        ActorSelector selector = new ActorSelector()
        {
            registerCondition = (g) => !(g.GetComponent <FOWEntity>().IsOwnedByPlayer),
            fireCondition     = (g) => true
        };

        Utils.Subscriber <FOWEntity.Actions, FOWEntity> .get.registerForAll(FOWEntity.Actions.DISCOVERED, OnEntityFound, selector);

        timeToShow = WAIT_FOR_FINISH;
    }
Beispiel #13
0
 void Awake()
 {
     conversationInitializer = ConversationInitializer.Instance;
     conversationWith        = null;
 }