Пример #1
0
        /// <summary>
        /// Sends object to the given position.
        /// </summary>
        /// <param name="imgo">The moving game object.</param>
        /// <param name="to">The point of the moving.</param>
        public void GoToLocation(IMovableGameObject imgo, Mogre.Vector3 to)
        {
            var a = new LinkedList <Mogre.Vector3>();

            a.AddLast(to);
            imgo.SetNextLocation(a);
        }
Пример #2
0
        /// <summary>
        /// Checks if the adding group is an atacker or a deffender and inserts it to
        /// the appropriate group and recalculates it.
        /// </summary>
        /// <param name="group">The inserting group.</param>
        public void AddGroup(GroupMovables group)
        {
            GroupManager groupMgr = Game.GroupManager;

            if (group.Team == groupAttackers.Team)
            {
                // Group is attacker
                int groupCount = group.Count;
                for (int i = 0; i < groupCount; i++)
                {
                    IMovableGameObject temp = group[0];
                    groupMgr.RemoveFromGroup(temp);
                    groupMgr.AddToGroup(groupAttackers, temp);
                    temp.StartAttack(this);
                }
                groupAttackers.Reselect();
                groupMgr.SelectGroup(groupAttackers);
            }
            else
            {
                // Group is deffender
                int groupCount = group.Count;
                for (int i = 0; i < groupCount; i++)
                {
                    IMovableGameObject temp = group[0];
                    groupMgr.RemoveFromGroup(temp);
                    groupMgr.AddToGroup(imgoDeffenders, temp);
                    temp.StartAttack(this);
                }
                groupAttackers.Reselect();
                groupMgr.SelectGroup(imgoDeffenders);
            }
        }
Пример #3
0
 /// <summary>
 /// Removes the IMovableGameObject from the SolarSystem.
 /// </summary>
 /// <param name="imgo">The removing object.</param>
 public void RemoveIMGO(IMovableGameObject imgo)
 {
     if (imgoObjectDict.ContainsKey(imgo.Name))
     {
         imgoObjectDict.Remove(imgo.Name);
     }
 }
Пример #4
0
        /// <summary>
        /// Shows GUI panel with possible travel destiantions and playes portal animation.
        /// </summary>
        /// <param name="imgo"></param>
        public void ShowTravelDestinations(IMovableGameObject imgo)
        {
            Game.CreateInterstellarTravel(imgo);

            isPorting        = true;
            portTimeDuration = portTime;
        }
Пример #5
0
 /// <summary>
 /// Removes the given movable object from the dictionary which contains controled movements.
 /// </summary>
 /// <param name="imgo"></param>
 public void UnlogFromFinishMoveReciever(IMovableGameObject imgo)
 {
     if (finishMoveRecDict.ContainsKey(imgo))
     {
         finishMoveRecDict.Remove(imgo);
     }
 }
Пример #6
0
 /// <summary>
 /// Inserts the given movable object to the team and sets its the team.
 /// </summary>
 /// <param name="imgo">The inserting movable object.</param>
 public void AddIMGO(IMovableGameObject imgo)
 {
     if (!imgoObjects.Contains(imgo)) {
         imgoObjects.Add(imgo);
         imgo.Team = this;
     }
 }
Пример #7
0
        /// <summary>
        /// Recieves information when object reached the destination. Checks if object is attacking or occupying and
        /// creates the appropriate class.
        /// </summary>
        /// <param name="imgo">The object in destiantion.</param>
        public void MovementFinished(IMovableGameObject imgo)
        {
            var onWayCopy  = new Dictionary <IMovableGameObject, GroupMovables>(onWayToTargetDict);
            var group      = onWayCopy[imgo];
            var gameObject = attackersTarget[imgo];
            var moveMgr    = Game.IMoveManager;

            // Remove all object which goint to the same target from a watch lists.
            foreach (IMovableGameObject item in onWayCopy[imgo])
            {
                onWayToTargetDict.Remove(item);
                attackersTarget.Remove(item);
                moveMgr.UnlogFromFinishMoveReciever(item);
            }

            if (offensiveActionDict[onWayCopy[imgo]] == ActionAnswer.Attack)
            {
                // Creates a Fight
                fightList.Add(new Fight(group, gameObject));
            }
            else
            {
                // Creates an Occupation
                occupationList.Add(new Occupation(group, gameObject));
            }
            offensiveActionDict.Remove(onWayCopy[imgo]);
        }
Пример #8
0
 /// <summary>
 /// Removes the given movable object from the team.
 /// </summary>
 /// <param name="imgo">The removing movable object.</param>
 public void RemoveIMGO(IMovableGameObject imgo)
 {
     if (imgoObjects.Contains(imgo))
     {
         imgoObjects.Remove(imgo);
     }
 }
Пример #9
0
 /// <summary>
 /// Removes given object from attackes targets. If the removing object is the current
 /// target then selects a new one.
 /// </summary>
 /// <param name="igo">The removing target.</param>
 private void RemoveFromAttackerTarget(IMovableGameObject igo)
 {
     imgoDeffenders.RemoveMember(igo);
     if (attackerTarget.Value == igo)
     {
         SelectAttackerTarget();
     }
 }
Пример #10
0
 /// <summary>
 /// Inserts the IMovableGameObject to the SolarSystem and sets SolarSystem visibility
 /// to the object.
 /// </summary>
 /// <param name="imgo">The inserting object.</param>
 public void AddIMGO(IMovableGameObject imgo)
 {
     if (!imgoObjectDict.ContainsKey(imgo.Name))
     {
         imgoObjectDict.Add(imgo.Name, imgo);
         imgo.ChangeVisible(active);
     }
 }
Пример #11
0
        /// <summary>
        /// Creates IMovableGameObject by given typeName and argument. Inserts the object to given SolarSystem and registers it in HitTest.
        /// </summary>
        /// <param name="typeName">The type of the creating object.</param>
        /// <param name="args">The arguments of the creating object.</param>
        /// <param name="solSyst">The creating object SolarSystem.</param>
        /// <returns>Returns created IMovableGameObject.</returns>
        public IMovableGameObject CreateImgo(string typeName, object[] args, SolarSystem solSyst)               // prepared...never used
        {
            IMovableGameObject imgo = xmlLoader.CreateIMGO(typeName, args);

            solSyst.AddIMGO(imgo);
            Game.HitTest.RegisterIMGO(imgo);
            return(imgo);
        }
Пример #12
0
 /// <summary>
 /// Inserts the given movable object to the team and sets its the team.
 /// </summary>
 /// <param name="imgo">The inserting movable object.</param>
 public void AddIMGO(IMovableGameObject imgo)
 {
     if (!imgoObjects.Contains(imgo))
     {
         imgoObjects.Add(imgo);
         imgo.Team = this;
     }
 }
Пример #13
0
 /// <summary>
 /// Attempts to remove IMovableGameObject from its group.
 /// </summary>
 /// <param Name="imgo">IMovableGameObject to remove from the group</param>
 public void RemoveFromGroup(IMovableGameObject imgo)
 {
     if (imgoGroupDict.ContainsKey(imgo))
     {
         imgoGroupDict[imgo].RemoveMember(imgo);
         imgoGroupDict.Remove(imgo);
     }
 }
Пример #14
0
 /// <summary>
 /// Unlogs given object from a watch lists.
 /// </summary>
 /// <param name="imgo">The object which interrupted the movement.</param>
 public void MovementInterupted(IMovableGameObject imgo)
 {
     if (onWayToTargetDict.ContainsKey(imgo))
     {
         offensiveActionDict.Remove(onWayToTargetDict[imgo]);
         onWayToTargetDict.Remove(imgo);
         attackersTarget.Remove(imgo);
     }
 }
Пример #15
0
 /// <summary>
 /// Removes the object from controlled movements and if something controls the movement
 /// so it sends the information to it.
 /// </summary>
 /// <param name="imgo">The object which interupted the movement.</param>
 public void MovementInterupted(IMovableGameObject imgo)
 {
     moveMgrControledDict.Remove(imgo);
     if (finishMoveRecDict.ContainsKey(imgo))
     {
         finishMoveRecDict[imgo].MovementInterupted(imgo);
         finishMoveRecDict.Remove(imgo);
     }
 }
Пример #16
0
 /// <summary>
 /// Finds IMovableGameObject at SolarSystems and removes it from the one.
 /// </summary>
 /// <param name="imgo">The removing object.</param>
 public void RemoveObjectFromSolarSystem(IMovableGameObject imgo)
 {
     foreach (var solSysPair in solarSystemDict)
     {
         if (solSysPair.Value.HasIMGO(imgo))
         {
             solSysPair.Value.RemoveIMGO(imgo);
             break;
         }
     }
 }
Пример #17
0
 /// <summary>
 /// Creates traveler from its current SolarSystem to new given SolarSystem.
 /// Object is removed and insert to new one by Traveler class.
 /// Also playes travel sound.
 /// </summary>
 /// <param name="from">The current object SolarSystem.</param>
 /// <param name="to">The future object SolarSystem.</param>
 /// <param name="gameObject">The traveling game object.</param>
 public static void CreateTraveler(SolarSystem from, SolarSystem to, object gameObject)
 {
     if (gameObject is IMovableGameObject)
     {
         if (from != to)
         {
             IMovableGameObject imgo = (IMovableGameObject)gameObject;
             Game.IEffectPlayer.PlayEffect(travelSound);
             travelerList.Add(new Traveler(from, to, (IMovableGameObject)imgo));
         }
     }
 }
Пример #18
0
        /// <summary>
        /// Recives the information that the constolled object reached the destination.
        /// Reports the information if some class wants to control this movement and
        /// sends the information to object to which the imgo travels.
        /// </summary>
        /// <param Name="imgo">The object which reached the destination.</param>
        /// <param Name="isgo">The target of the movement.</param>
        private void ReachedDestiantion(IMovableGameObject imgo, IGameObject gameObject)
        {
            if (finishMoveRecDict.ContainsKey(imgo))
            {
                finishMoveRecDict[imgo].MovementFinished(imgo);
                finishMoveRecDict.Remove(imgo);
            }

            if (imgo.Visible)
            {
                imgo.Stop();
                gameObject.TargetInSight(imgo);
            }
        }
Пример #19
0
 /// <summary>
 /// Removes given object from deffenders targets. If the removing object is the current
 /// target then selects a new one. Also controls if exist any next attacker (if not fight ends).
 /// </summary>
 /// <param name="igo">The removing target.</param>
 private void RemoveFromDeffenderTarget(IMovableGameObject igo)
 {
     groupAttackers.RemoveMember(igo);
     if (deffenderTarget.Value == igo)
     {
         if (groupAttackers.Count != 0)
         {
             deffenderTarget.Value = groupAttackers[0];
         }
         else
         {
             EndFight();
         }
     }
 }
Пример #20
0
        /// <summary>
        /// Initializes Traveler and calculates the time of the travel (from the distance between
        /// SolarSystems). Also creates the object invisible and removes it from current SolarSystem.
        /// </summary>
        /// <param name="from">The SolarSystem with the traveler</param>
        /// <param name="to">The target SolarSystem of the traveler</param>
        /// <param name="traveler">The traveling object</param>
        public Traveler(SolarSystem from, SolarSystem to, IMovableGameObject traveler)
        {
            this.from = from;
            this.to = to;
            this.traveler = traveler;
            long travelTime = (long)GetSquareOfDistance(from, to);

            timeToGo = new Property<TimeSpan>(new TimeSpan(travelTime*60)); // Multiply by 60

            traveler.Stop();

            // Removes from current SolarSystem
            from.RemoveIMGO(traveler);
            traveler.ChangeVisible(false);
        }
Пример #21
0
        /// <summary>
        /// Initializes Traveler and calculates the time of the travel (from the distance between
        /// SolarSystems). Also creates the object invisible and removes it from current SolarSystem.
        /// </summary>
        /// <param name="from"></param>
        /// <param name="to"></param>
        /// <param name="traveler"></param>
        public Traveler(SolarSystem from, SolarSystem to, IMovableGameObject traveler)
        {
            this.from     = from;
            this.to       = to;
            this.traveler = traveler;
            long travelTime = (long)GetSquareOfDistance(from, to);

            timeToGo = new Property <TimeSpan>(new TimeSpan(travelTime * 60));          // Multiply by 60

            traveler.Stop();

            // Removes from current SolarSystem
            from.RemoveIMGO(traveler);
            traveler.ChangeVisible(false);
        }
Пример #22
0
        /// <summary>
        /// Inserts the given group to attacker group and sends it
        /// to target destination and recalculates the group.
        /// </summary>
        /// <param name="group">The inserting group.</param>
        public void AddGroup(GroupMovables group)
        {
            GroupManager groupMgr = Game.GroupManager;

            Game.IMoveManager.GoToTarget(group, target);
            int groupCount = group.Count;

            for (int i = 0; i < groupCount; i++)
            {
                IMovableGameObject temp = group[0];
                groupMgr.RemoveFromGroup(temp);
                groupMgr.AddToGroup(attackers, temp);
            }
            attackers.Reselect();
            groupMgr.SelectGroup(attackers);
        }
Пример #23
0
        /// <summary>
        /// Finds required group by the given object. If it is not exists so the new is created
        /// just with given object.
        /// </summary>
        /// <param name="imgo">The object which the group is looking for.</param>
        /// <returns>Returns the founded group or a new one</returns>
        public GroupMovables GetGroup(IMovableGameObject imgo)
        {
            GroupMovables group;

            if (imgoGroupDict.ContainsKey(imgo))
            {
                group = imgoGroupDict[imgo];
            }
            else
            {
                group = new GroupMovables(imgo.Team);
                group.InsertMemeber(imgo);
                imgoGroupDict.Add(imgo, group);
            }
            return(group);
        }
Пример #24
0
 /// <summary>
 /// Removes moveble object from its Team. 
 /// </summary>
 /// <param name="imgo">The removing moveble object.</param>
 public void RemoveFromOwnTeam(IMovableGameObject imgo)
 {
     imgo.Team.RemoveIMGO(imgo);
 }
Пример #25
0
 /// <summary>
 /// Removes the object from the old Team and inserts it to the given Team.
 /// </summary>
 /// <param name="imgo">The removing movable object.</param>
 /// <param name="newTeam">The new Team of the movable object.</param>
 public void ChangeTeam(IMovableGameObject imgo, Team newTeam)
 {
     RemoveFromOwnTeam(imgo);
     newTeam.AddIMGO(imgo);
 }
Пример #26
0
 /// <summary>
 /// Just recieves the information and does nothing.
 /// </summary>
 /// <param name="imgo">The object which reached the destination.</param>
 public void MovementFinished(IMovableGameObject imgo)
 {
 }
Пример #27
0
        /// <summary>
        /// Initializes the FightManager from two given lists (occupation and fights).
        /// </summary>
        /// <param name="loadedOcc">The list with occupations.</param>
        /// <param name="loadedFights">The list with fights.</param>
        public void Initialize(List <Tuple <List <string>, string, int> > loadedOcc, List <Tuple <List <string>, List <string> > > loadedFights)
        {
            // Occupations
            if (loadedOcc != null)
            {
                foreach (var occupation in loadedOcc)
                {
                    IMovableGameObject firstObj = null;
                    foreach (var gameObject in occupation.Item1)
                    {
                        if (Game.HitTest.IsObjectControllable(gameObject) && Game.HitTest.IsObjectMovable(gameObject))
                        {
                            firstObj = Game.HitTest.GetIMGO(gameObject);
                            break;
                        }
                    }
                    if (firstObj == null)
                    {
                        // Invalid data
                        continue;
                    }
                    GroupMovables group = Game.GroupManager.GetGroup(firstObj);

                    // Creates group
                    for (int i = 1; i < occupation.Item1.Count; i++)
                    {
                        if (Game.HitTest.IsObjectControllable(occupation.Item1[i]) && Game.HitTest.IsObjectMovable(occupation.Item1[i]))
                        {
                            Game.GroupManager.AddToGroup(group, Game.HitTest.GetIMGO(occupation.Item1[i]));
                        }
                    }

                    if (group.Count == 0)
                    {
                        // Invalid data
                        continue;
                    }
                    IGameObject target;
                    if (Game.HitTest.IsObjectControllable(occupation.Item2))
                    {
                        target = Game.HitTest.GetGameObject(occupation.Item2);
                    }
                    else
                    {
                        // Invalid data
                        continue;
                    }

                    if (target.OccupyTime == occupation.Item3)
                    {
                        Occupy(group, target);
                    }
                    else
                    {
                        // Create Occupation
                        occupationList.Add(new Occupation(group, target, TimeSpan.FromSeconds(occupation.Item3)));
                    }
                }
            }

            // Fights
            if (loadedFights != null)
            {
                foreach (var fight in loadedFights)
                {
                    var           firstObj = Game.HitTest.GetIMGO(fight.Item1[0]);
                    GroupMovables group1   = Game.GroupManager.GetGroup(firstObj);
                    // Creates group1
                    for (int i = 1; i < fight.Item1.Count; i++)
                    {
                        if (Game.HitTest.IsObjectControllable(fight.Item1[i]) && Game.HitTest.IsObjectMovable(fight.Item1[i]))
                        {
                            Game.GroupManager.AddToGroup(group1, Game.HitTest.GetIMGO(fight.Item1[i]));
                        }
                    }

                    if (group1.Count == 0)
                    {
                        continue;
                    }

                    // Second group can contains the static members
                    IGameObject   firstObj1 = null;
                    GroupMovables group2    = null;
                    foreach (var gameObject in fight.Item2)
                    {
                        if (Game.HitTest.IsObjectControllable(gameObject))
                        {
                            firstObj1 = Game.HitTest.GetGameObject(gameObject);
                            group2    = new GroupMovables(firstObj1.Team);
                            break;
                        }
                    }
                    GroupStatics group3 = new GroupStatics();

                    if (Game.HitTest.IsObjectControllable(fight.Item2[0]))
                    {
                        if (Game.HitTest.IsObjectMovable(fight.Item2[0]))
                        {
                            var firstObj2 = Game.HitTest.GetIMGO(fight.Item2[0]);
                            group2 = Game.GroupManager.GetGroup(firstObj2);
                        }
                        else
                        {
                            var firstObj3 = Game.HitTest.GetISGO(fight.Item2[0]);
                            group3 = new GroupStatics(firstObj3.Team);
                            group3.InsertMemeber(firstObj3);
                        }
                    }

                    if (group2 == null || group3 == null || group2.Count == 0 && group3.Count == 0)
                    {
                        // Invalid data
                        continue;
                    }

                    for (int i = 1; i < fight.Item2.Count; i++)
                    {
                        if (Game.HitTest.IsObjectMovable(fight.Item2[i]))
                        {
                            Game.GroupManager.AddToGroup(group2, Game.HitTest.GetIMGO(fight.Item2[i]));
                        }
                        else
                        {
                            group3.InsertMemeber(Game.HitTest.GetISGO(fight.Item2[i]));
                        }
                    }
                    fightList.Add(new Fight(group1, group2, group3));
                }
            }
        }
Пример #28
0
 /// <summary>
 /// Removes given object from attackes targets. If the removing object is the actual
 /// target then selects new one.
 /// </summary>
 /// <param name="igo">The removing target.</param>
 private void RemoveFromAttackerTarget(IMovableGameObject igo)
 {
     imgoDeffenders.RemoveMember(igo);
     if (attackerTarget.Value == igo) {
         SelectAttackerTarget();
     }
 }
Пример #29
0
 /// <summary>
 /// Removes the object from the old Team and inserts it to the given Team.
 /// </summary>
 /// <param name="imgo">The removing movable object.</param>
 /// <param name="newTeam">The new Team of the movable object.</param>
 public void ChangeTeam(IMovableGameObject imgo, Team newTeam)
 {
     RemoveFromOwnTeam(imgo);
     newTeam.AddIMGO(imgo);
 }
Пример #30
0
 /// <summary>
 /// Removes given object from deffenders targets. If the removing object is the actual
 /// target then selects new one. Also controls if exist any next attacker (if not fight ends).
 /// </summary>
 /// <param name="igo">The removing target.</param>
 private void RemoveFromDeffenderTarget(IMovableGameObject igo)
 {
     groupAttackers.RemoveMember(igo);
     if (deffenderTarget.Value == igo) {
         if (groupAttackers.Count != 0) {
             deffenderTarget.Value = groupAttackers[0];
         } else {
             EndFight();
         }
     }
 }
Пример #31
0
        /// <summary>
        /// Recieves information when object reached the destination. Checks if object is attacking or occupying and 
        /// creates the appropriate class.
        /// </summary>
        /// <param name="imgo">The object in destiantion.</param>
        public void MovementFinished(IMovableGameObject imgo)
        {
            var onWayCopy = new Dictionary<IMovableGameObject, GroupMovables>(onWayToTargetDict);
            var group = onWayCopy[imgo];
            var gameObject = attackersTarget[imgo];
            var moveMgr = Game.IMoveManager;
            // Remove all object which goint to the same target from a watch lists.
            foreach (IMovableGameObject item in onWayCopy[imgo]) {
                onWayToTargetDict.Remove(item);
                attackersTarget.Remove(item);
                moveMgr.UnlogFromFinishMoveReciever(item);
            }

            if (offensiveActionDict[onWayCopy[imgo]] == ActionAnswer.Attack) {
                // Creates a Fight
                fightList.Add(new Fight(group, gameObject));
            } else {
                // Creates an Occupation
                occupationList.Add(new Occupation(group, gameObject));
            }
            offensiveActionDict.Remove(onWayCopy[imgo]);
        }
Пример #32
0
 /// <summary>
 /// Unlogs given object from a watch lists.
 /// </summary>
 /// <param name="imgo">The object which interrupted the movement.</param>
 public void MovementInterupted(IMovableGameObject imgo)
 {
     if (onWayToTargetDict.ContainsKey(imgo)) {
         offensiveActionDict.Remove(onWayToTargetDict[imgo]);
         onWayToTargetDict.Remove(imgo);
         attackersTarget.Remove(imgo);
     }
 }
Пример #33
0
 /// <summary>
 /// Inserts the IMovableGameObject to the SolarSystem and sets SolarSystem visibility
 /// to the object. 
 /// </summary>
 /// <param name="imgo">The inserting object.</param>
 public void AddIMGO(IMovableGameObject imgo)
 {
     if (!imgoObjectDict.ContainsKey(imgo.Name)) {
         imgoObjectDict.Add(imgo.Name, imgo);
         imgo.ChangeVisible(active);
     }
 }
Пример #34
0
 /// <summary>
 /// Adds new object to imgoDict and also adds to objectIsMovable as movable (true).
 /// </summary>
 /// <param name="imgo">The inserting object.</param>
 public void RegisterIMGO(IMovableGameObject imgo)
 {
     objectIsMovable.Add(imgo.Name, true);
     imgoDict.Add(imgo.Name, imgo);
 }
Пример #35
0
 /// <summary>
 /// Removes the IMovableGameObject from the SolarSystem. 
 /// </summary>
 /// <param name="imgo">The removing object.</param>
 public void RemoveIMGO(IMovableGameObject imgo)
 {
     if (imgoObjectDict.ContainsKey(imgo.Name)) {
         imgoObjectDict.Remove(imgo.Name);
     }
 }
Пример #36
0
 /// <summary>
 /// Shows panel with possible travel destiantions (ShowTravelDestinations).
 /// </summary>
 /// <param name="target">The target which invoke this calling.</param>
 public override void TargetInSight(IMovableGameObject target)
 {
     ShowTravelDestinations(target);
 }
Пример #37
0
 /// <summary>
 /// Sends object to the given position. 
 /// </summary>
 /// <param name="imgo">The moving game object.</param>
 /// <param name="to">The point of the moving.</param>
 public void GoToLocation(IMovableGameObject imgo, Mogre.Vector3 to)
 {
     var a = new LinkedList<Mogre.Vector3>();
     a.AddLast(to);
     imgo.SetNextLocation(a);
 }
 /// <summary>
 /// Finds IMovableGameObject at SolarSystems and removes it from the one.
 /// </summary>
 /// <param name="imgo">The removing object.</param>
 public void RemoveObjectFromSolarSystem(IMovableGameObject imgo)
 {
     foreach (var solSysPair in solarSystemDict) {
         if (solSysPair.Value.HasIMGO(imgo)) {
             solSysPair.Value.RemoveIMGO(imgo);
             break;
         }
     }
 }
Пример #39
0
 /// <summary>
 /// Receives information that the object interupted movement.
 /// Does nothing with this object.
 /// </summary>
 /// <param name="imgo">The object interupted movement.</param>
 public void MovementInterupted(IMovableGameObject imgo)
 {
 }
Пример #40
0
 /// <summary>
 /// Sends the movable object to the position and registers the object to controlled movements.
 /// </summary>
 /// <param name="imgo">The movable object which is sended to the position of the game object.</param>
 /// <param name="gameObject">The object where the movable object goes.</param>
 /// <param name="reciever">The IFinishMovementReciever for the movable object.</param>
 public void GoToTarget(IMovableGameObject imgo, IGameObject gameObject, IFinishMovementReciever reciever)
 {
     imgo.GoToTarget(gameObject);
     moveMgrControledDict.Add(imgo, gameObject);
     finishMoveRecDict.Add(imgo, reciever);
 }
Пример #41
0
 /// <summary>
 /// Doesn't react on the target in sight (objects should override).
 /// </summary>
 /// <param name="target">The target which invoke this calling.</param>
 public virtual void TargetInSight(IMovableGameObject target)
 {
 }
Пример #42
0
 /// <summary>
 /// Just recieves the information and does nothing.
 /// </summary>
 /// <param name="imgo">The object which reached the destination.</param>
 public void MovementFinished(IMovableGameObject imgo)
 {
 }
Пример #43
0
 /// <summary>
 /// Receives information that the object reached the destiantion.
 /// </summary>
 /// <param name="imgo">The object in destination.</param>
 public void MovementFinished(IMovableGameObject imgo)
 {
     movingDict.Remove(imgo);
     imgo.StartAttack(this);
 }
Пример #44
0
 /// <summary>
 /// Removes the object from controlled movements and if something controls the movement
 /// so it sends the information to it.
 /// </summary>
 /// <param name="imgo">The object which interupted the movement.</param>
 public void MovementInterupted(IMovableGameObject imgo)
 {
     moveMgrControledDict.Remove(imgo);
     if (finishMoveRecDict.ContainsKey(imgo)) {
         finishMoveRecDict[imgo].MovementInterupted(imgo);
         finishMoveRecDict.Remove(imgo);
     }
 }
Пример #45
0
 /// <summary>
 /// Sends the movable object to the position and registers the object to controlled movements.
 /// </summary>
 /// <param name="imgo">The movable object which is sended to the position of the game object.</param>
 /// <param name="gameObject">The object where the movable object goes.</param>
 /// <param name="reciever">The IFinishMovementReciever for the movable object.</param>
 public void GoToTarget(IMovableGameObject imgo, IGameObject gameObject, IFinishMovementReciever reciever)
 {
     imgo.GoToTarget(gameObject);
     moveMgrControledDict.Add(imgo, gameObject);
     finishMoveRecDict.Add(imgo, reciever);
 }
Пример #46
0
 /// <summary>
 /// Removes the given movable object from the dictionary which contains controled movements.
 /// </summary>
 /// <param name="imgo"></param>
 public void UnlogFromFinishMoveReciever(IMovableGameObject imgo)
 {
     if (finishMoveRecDict.ContainsKey(imgo)) {
         finishMoveRecDict.Remove(imgo);
     }
 }
Пример #47
0
 /// <summary>
 /// Sends the given object to the given position.
 /// </summary>
 /// <param name="imgo">The IMovableGameObject which is sended to the destiantion.</param>
 /// <param name="target">The object where the group goes.</param>
 private void GoToTargetIMGO(IMovableGameObject imgo, IGameObject target)
 {
     imgo.GoToTarget(target);
     moveMgrControledDict.Add(imgo, target);
 }
Пример #48
0
 /// <summary>
 /// Sends the given object to the given position. 
 /// </summary>
 /// <param name="imgo">The IMovableGameObject which is sended to the destiantion.</param>
 /// <param name="target">The object where the group goes.</param>
 private void GoToTargetIMGO(IMovableGameObject imgo, IGameObject target)
 {
     imgo.GoToTarget(target);
     moveMgrControledDict.Add(imgo, target);
 }
Пример #49
0
 /// <summary>
 /// Adds new object to the imgoDict and also adds to the objectIsMovable as a movable (true).
 /// </summary>
 /// <param name="imgo">The inserting object.</param>
 public void RegisterIMGO(IMovableGameObject imgo)
 {
     objectIsMovable.Add(imgo.Name, true);
     imgoDict.Add(imgo.Name, imgo);
 }
Пример #50
0
        /// <summary>
        /// Recives the information that the constolled object reached the destination.
        /// Reports the information if some class wants to control this movement and 
        /// sends the information to object to which the imgo travels.
        /// </summary>
        /// <param Name="imgo">The object which reached the destination.</param>
        /// <param Name="isgo">The target of the movement.</param>
        private void ReachedDestiantion(IMovableGameObject imgo, IGameObject gameObject)
        {
            if (finishMoveRecDict.ContainsKey(imgo)) {
                finishMoveRecDict[imgo].MovementFinished(imgo);
                finishMoveRecDict.Remove(imgo);
            }

            if (imgo.Visible) {
                imgo.Stop();
                gameObject.TargetInSight(imgo);
            }
        }
Пример #51
0
 /// <summary>
 /// Removes the given movable object from the team. 
 /// </summary>
 /// <param name="imgo">The removing movable object.</param>
 public void RemoveIMGO(IMovableGameObject imgo)
 {
     if (imgoObjects.Contains(imgo)) {
         imgoObjects.Remove(imgo);
     }
 }
Пример #52
0
 /// <summary>
 /// Check if SolarSystem contains the IMovableGameObject.
 /// </summary>
 /// <param name="imgo">The checking object.</param>
 /// <returns>Returns if the SolarSystem contains the object.</returns>
 public bool HasIMGO(IMovableGameObject imgo)
 {
     return imgoObjectDict.ContainsKey(imgo.Name);
 }
Пример #53
0
 /// <summary>
 /// Removes movable game object from group, from solar system and calls Destroy to remove object from the game.
 /// </summary>
 /// <param Name="gameObject">IMovableGameObject to remove from the game.</param>
 public void DestroyGameObject(IMovableGameObject imgo)
 {
     RemoveFromGroup(imgo);
     imgo.Destroy();
     Game.SolarSystemManager.RemoveObjectFromSolarSystem(imgo);
 }
Пример #54
0
 /// <summary>
 /// Finds required group by given object. If it is not exists so the new is created
 /// just with given object.
 /// </summary>
 /// <param name="imgo">The object which the group is looking for.</param>
 /// <returns></returns>
 public GroupMovables GetGroup(IMovableGameObject imgo)
 {
     GroupMovables group;
     if (imgoGroupDict.ContainsKey(imgo)) {
         group = imgoGroupDict[imgo];
     } else {
         group = new GroupMovables(imgo.Team);
         group.InsertMemeber(imgo);
         imgoGroupDict.Add(imgo, group);
     }
     return group;
 }
Пример #55
0
 /// <summary>
 /// Shows panel with possible travel destiantions (ShowTravelDestinations).
 /// </summary>
 /// <param name="target">The target which invoke this calling.</param>
 public override void TargetInSight(IMovableGameObject target)
 {
     ShowTravelDestinations(target);
 }
Пример #56
0
 /// <summary>
 /// Attempts to remove IMovableGameObject from its group.
 /// </summary>
 /// <param Name="imgo">IMovableGameObject to remove from the group</param>
 public void RemoveFromGroup(IMovableGameObject imgo)
 {
     if (imgoGroupDict.ContainsKey(imgo)) {
         imgoGroupDict[imgo].RemoveMember(imgo);
         imgoGroupDict.Remove(imgo);
     }
 }
Пример #57
0
 /// <summary>
 /// Removes moveble object from its Team.
 /// </summary>
 /// <param name="imgo">The removing moveble object.</param>
 public void RemoveFromOwnTeam(IMovableGameObject imgo)
 {
     imgo.Team.RemoveIMGO(imgo);
 }
Пример #58
0
        /// <summary>
        /// Shows GUI panel with possible travel destiantions and playes a portal animation.
        /// </summary>
        /// <param name="imgo"></param>
        public void ShowTravelDestinations(IMovableGameObject imgo)
        {
            Game.CreateInterstellarTravel(imgo);

            isPorting = true;
            portTimeDuration = portTime;
        }