/// <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); } }
/// <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); }
/// <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); }
/// <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); } }