Thread: A little fun?
View Single Post
  #1  
Old 03-15-2012, 09:06 PM
bolox bolox is offline
Approved Member
 
Join Date: May 2008
Posts: 351
Default A little fun?

a quick, hopefully fun 'slalom race' offline mission with a timer and 'gate passing' script.



http://www.mediafire.com/download.php?2itdv8u9sclio7b

script
Code:
using System;
using System.Collections;
using System.Collections.Generic;
using maddox.game;
using maddox.game.world;
using maddox.GP;
using System.Diagnostics;

public class Mission : AMission{
	Stopwatch missionTimer = new Stopwatch();
		int aa = 0;//trigger count 
		double sw = 0;//stopwatch
		double se = 0;//stopwatch calculated
	 public override void OnBattleStarted() {
        base.OnBattleStarted();
		missionTimer.Start();
    }
    public override void OnTrigger(int missionNumber, string shortName, bool active) {
        if ("start".Equals(shortName) && active) {
		aa = 0;
		missionTimer.Restart();
		{
		GamePlay.gpHUDLogCenter("GO");//start
		}
		}
		if ("b".Equals(shortName) && active) {//gate 1
		++aa;
		{GamePlay.gpHUDLogCenter("1");
		}
		}
		if ("c".Equals(shortName) && active) {//gate2
		++aa;
		{GamePlay.gpHUDLogCenter("2");
		}
		}
		if ("d".Equals(shortName) && active) {//gate 3
		++aa;
		{GamePlay.gpHUDLogCenter("3");
		}
		}
		if ("e".Equals(shortName) && active) {//gate 4
		++aa;
		{GamePlay.gpHUDLogCenter("4");
		}
		}
		 if ("finish".Equals(shortName) && active) {	//finish
		missionTimer.Stop();
		double initTime = 0.0;
		 sw = missionTimer.Elapsed.TotalMilliseconds;
		 se = sw/1000;{
		GamePlay.gpHUDLogCenter("TIME:"+se);
		Timeout(initTime += 5.0, () =>
		{
		GamePlay.gpHUDLogCenter("GATES:"+aa);
		});
		}
		}
	}
  }
very simple airstart mission that's a 'proof of concept' but might be an idea for something a bit different?
Reply With Quote