public void launch()
 {
     Debug.Log("launch ActiveMission time " + missionData.getDurationSeconds());
     iTween.MoveTo(rocket.gameObject, iTween.Hash(
                       "path", flightPlan.flightPath.nodes.ToArray(),
                       "time", missionData.getDurationSeconds(),
                       "easeType", iTween.EaseType.easeInSine,
                       "oncomplete", "onMissionComplete",
                       "oncompletetarget", missionControl.gameObject,
                       "oncompleteparams", this
                       )
                   );
 }
 public ActiveMission(MissionControl missionControl, Rocket rocket, MissionData mission, float realtimeSinceStartup, FlightPlan flightPlan)
 {
     this.rocket               = rocket;
     this.missionControl       = missionControl;
     missionData               = mission;
     startTime                 = realtimeSinceStartup;
     this.flightPlan           = flightPlan;
     rocket.transform.position = flightPlan.flightPath.nodes[0];
     duration = mission.getDurationSeconds();
 }
Exemple #3
0
    public void launchMission(MissionData mission)
    {
        Debug.Log("launchMission: " + mission);
        setUiModeMissionControl();

        FlightPlan flightPlan = registry.flightPlans.Where(plan => plan.destination == mission.destinationData).First();
        Rocket     rocket     = GameObject.Instantiate(mission.rocketData.rocketObject);

        rocket.setSprite(mission.rocketData.icon);

        var activeMission = new ActiveMission(this, rocket, mission, Time.time, flightPlan);

        gameState.registerActiveMission(activeMission);
        gameState.funds -= mission.getCost();
        gameState.registerProgress(mission.destinationData.progressionValue);
        activeMission.launch();

        if (missionWillFail(mission))
        {
            float explodeAfter = mission.getDurationSeconds() * 0.1f * Convert.ToSingle(random.NextDouble());
            StartCoroutine(failMission(activeMission, explodeAfter));
        }
    }