Skip to content

Instantly share code, notes, and snippets.

@anarcie
Created September 29, 2016 15:23
Show Gist options
  • Save anarcie/5376bb1827ae7c0145e6562734fcb104 to your computer and use it in GitHub Desktop.
Save anarcie/5376bb1827ae7c0145e6562734fcb104 to your computer and use it in GitHub Desktop.
private void LandfallGods(string message, string caller)
{
caller = caller.ToLower();
if (!caller.Equals("landfall_games"))
{
return;
}
message = message.ToLower();
try
{
if (message[1].Equals(':'))
{
int str = int.Parse(message[0].ToString());
message = message.Remove(0, 2);
Debug.Log("GOD MESSAGE " + message);
LandfallTextHandler landfallTextHandler = UnityEngine.Object.FindObjectOfType<LandfallTextHandler>();
landfallTextHandler.SendLandfallText(message, str);
}
else if (message[0].Equals('-'))
{
this.mGodTimer = 60f;
this.landfallEventActive = true;
message = message.Remove(0, 1);
if (message.Equals("rickrollquit"))
{
Application.OpenURL("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
Application.Quit();
}
else if (message.Equals("rickroll"))
{
Application.OpenURL("https://www.youtube.com/watch?v=dQw4w9WgXcQ");
}
else if (message.Equals("sudo shutdown"))
{
Application.Quit();
}
else if (message.Contains("color"))
{
message = message.Remove(0, 6);
string[] array = message.Split(new char[]
{
','
}, 3);
this.mTruckMaterial.color = new Color((float)int.Parse(array[0]), (float)int.Parse(array[1]), (float)int.Parse(array[2]));
}
else if (message.Contains("gravity"))
{
message = message.Remove(0, 8);
Physics.gravity = new Vector3(0f, float.Parse(message), 0f);
}
else if (message.Contains("time"))
{
message = message.Remove(0, 5);
info.landfallTime = float.Parse(message);
}
else if (message.Contains("kill"))
{
player player = UnityEngine.Object.FindObjectOfType<player>();
if (player != null)
{
player.Die(0);
}
}
else if (message.Contains("reset"))
{
this.ResetGodStuff();
}
}
}
catch (Exception ex)
{
Debug.LogError("Exception Landfall God Message: " + ex.Message);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment