Jump to content
Atavism Online

Useable Assets for Atavism


bbautista
 Share

Recommended Posts

Hey guys I just found a good asset to use with Atavism. Lets keep this thread going. If you know of any assets that can be used with atavism that doesnt break it..please paste the link store address below.

 

Heres mine

 

Compass Navigator Pro (works well drop and go)

 

https://www.assetstore.unity3d.com/en/?utm_source=assetstore&utm_medium=text&utm_campaign=as_global_acquisition_2016-12-global-homepage-interstitial-new-user-dismiss#!/content/59519

Link to comment
Share on other sites

UniStorm is my all time Favorite asset to use... Just need to write some server side glue code to sync the cycle, generate weather, and sync the weather... Could even handle keeping track of the day, seasons, ect. on the server for use in generating the weather and keeping it all synced.

 

https://www.assetstore.unity3d.com/en/#!/content/2714

 

The Code for updating it is pretty simple...

 

Run this once every second... Will result in a 40 minute cycle I believe...

 


class EnvironmentTick implements Runnable{

	@Override
	public void run() {
		seconds = seconds + 1;

		if(startTime >= 1)
			seconds = 0;

		//startTime = (seconds / 86400);
		startTime = (seconds / 2400);
	}

}

 

Run this every 15 minutes or however often you want to sync the cycle with the clients:

 


class EnvironmentSync implements Runnable{

	@Override
	public void run() {
		for (int i = 0; i < Oids.size(); i++) {
			OID objOid = Oids.get(i);

            HashMap props = new HashMap();
            props.put("ext_msg_subtype", "Env.Sync");
            props.put("startTime", startTime);
            props.put("year", Year);
            props.put("month", Month);
            props.put("day", Day);
            props.put("weather", weather);
            TargetedExtensionMessage _msg = new TargetedExtensionMessage(WorldManagerClient.MSG_TYPE_EXTENSION, objOid, objOid, false, props);
            Engine.getAgent().sendBroadcast(_msg);
		}

		//Log.debug("EnvironmentPlugin: " + String.valueOf(startTime));
	}
}

 

Run this every 15 minutes or however often you want to potentially generate weather... This was just a test at giving different months a different percentage of generating weather so at the moment I only have December being used... Did have a real time Day/Night cycle based on the day, month, year, and time of the server when I wrote this code. This code also forces a Change in weather if more then an hour has passed since the last time it changed.

 


class ChangeWeather implements Runnable{

	@Override
	public void run() {
		// TODO Auto-generated method stub
		int percent = GetRandom(0, 100);

		if(Month == 12)
		{
			if(percent <= 25 || forceWeatherChange >= 4){
				weather = GetRandom(1, 11);

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}

		forceWeatherChange++;
	}

}

Link to comment
Share on other sites

Definitely Terrain Composer 2 http://www.terraincomposer.com. Super simple system for making good looking terrains, quickly, easily, and without hassle. I cannot handle the Unity terrain editing process, and was so disappointed that I might have had to make everything externally and plug it in. But this program makes it so I do not need to do that, and have been using it happily for several months. It's a new program so it has some bugs, but it's worth it.

Link to comment
Share on other sites

  • 3 weeks later...
  • 1 month later...

Resolve:

 

 

TimeManager:

using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class TimeManager : MonoBehaviour {

static TimeManager instance;

public string timeGameObjectName;
int day;
int hour;
int minute;
float second = -1;
   int worldTimeSpeed = 1;
string currentTime = "";

float delay = 3;
float updateTime = -1;
float lastFrameTime = -1;

// Use this for initialization
void Start () {
	instance = this;
	NetworkAPI.RegisterExtensionMessageHandler("server_time", ServerTimeMessage);
}

// Update is called once per frame
void Update () {
	if (second == -1)
		return;

	// Recalculate the current time
	second += (Time.realtimeSinceStartup - lastFrameTime) * worldTimeSpeed;
	lastFrameTime = Time.realtimeSinceStartup;
	if (second >= 60) {
		int minutesPassed = (int)second / 60;
		second -= 60 * minutesPassed;
		minute += minutesPassed;

		if (minute >= 60) {
			minute -= 60;
			hour += 1;
		}
		if (hour >= 24) {
			hour -= 24;
			day += 1;
		}

		// Send out a time update message since the minute/hour has changed
		string[] args = new string[1];
		AtavismEventSystem.DispatchEvent("WORLD_TIME_UPDATE", args);
		//Debug.Log("Time is now: " + hour + ":" + minute + " with deltaTime: " + Time.deltaTime + " and minutesPassed: " + minutesPassed);
	}

	if (timeGameObjectName != "" && updateTime != -1 && Time.time > updateTime) {
		GameObject timeReqGameObject = GameObject.Find(timeGameObjectName);
		if (timeReqGameObject != null) {
			timeReqGameObject.SendMessage("SetSecond", second);
			timeReqGameObject.SendMessage("SetMinute", minute);
			timeReqGameObject.SendMessage("SetHour", hour);
			timeReqGameObject.SendMessage("SetDay", day);
		}
		updateTime = -1;
	}
}

public void ServerTimeMessage(Dictionary props) {
	day = (int)props["day"];
	hour = (int)props["hour"];
	minute = (int)props["minute"];
	second = (int)props["second"];
	worldTimeSpeed = (int)props["worldTimeSpeed"];
	//Debug.Log("Got Server Time Message with Day: " + day + ", hour: " + hour + ". minute: " + minute);
	lastFrameTime = Time.realtimeSinceStartup;
	updateTime = Time.time + delay;
}

public static TimeManager Instance {
	get {
		return instance;
	}
}

public string CurrentTime {
	get {
		return currentTime;
	}
}

public int Hour {
	get {
		return hour;
	}
}

public int Minute {
	get {
		return minute;
	}
}

   public float Second
   {
       get {
           return second;
       }
   }

   public int Day
   {
       get
       {
           return day;
       }
   }

}

 

UGUIWorldTimeDisplayPersonal:

using UnityEngine;
using System;
using UnityEngine.UI;
using System.Collections;

public class UGUIWorldTimeDisplayPersonal : MonoBehaviour {
   //
   public GameObject uniStormSystem;
   //
   public string day;
   //
   public int Month;
   //
   public int Year;
   //
   public string hour;
   //
   public string minute;
   //
   public string second;
   //
   public string timeText;
   //
   public string dateText;
   //
   void Awake()
   {
       //
       uniStormSystem = GameObject.Find("UniStormSystemEditor");
       //
   }
   //
   // Use this for initialization
   //
   void Start () {
       //
	AtavismEventSystem.RegisterEvent("WORLD_TIME_UPDATE", this);
       //
       Month = System.DateTime.Now.Month;
       //
       Year = System.DateTime.Now.Year;
       //
       uniStormSystem.GetComponent().monthCounter = Month;
       //
       uniStormSystem.GetComponent().yearCounter = Year;
       //
       UpdateTimeDisplay();
       //

   }
   //
   // Update is called once per frame
   //
   void Update()
   {
       //
       dateText = System.DateTime.Now.ToString("dd/MM/yyyy HH:mm:ss");
       //
       UpdateTimeDisplay();
       //
   }
   //
   void OnDestroy() {
       //
       AtavismEventSystem.UnregisterEvent("WORLD_TIME_UPDATE", this);
       //
   }
   //
public void OnEvent(AtavismEventData eData) {
       //
       if (eData.eventType == "WORLD_TIME_UPDATE") {
           //
           UpdateTimeDisplay();
           //
       }
       //
}
//
void UpdateTimeDisplay() {
       //
       if (timeText != null) {
           //
		// Get time from the time system and set it to the text
           //
		hour = TimeManager.Instance.Hour.ToString();
           //
		if (TimeManager.Instance.Hour < 10) {
               //
			hour = "0" + hour;
               //
		}
           //
		minute = TimeManager.Instance.Minute.ToString();
           //
		if (TimeManager.Instance.Minute < 10) {
               //
			minute = "0" + minute;
               //
		}
           //
           second = TimeManager.Instance.Second.ToString();
           //
		if (TimeManager.Instance.Second < 10) {
               //
               second = "0" + second;
               //
		}
           //
           day = TimeManager.Instance.Day.ToString();
           //
           timeText = day + " / " + hour + ":" + minute + ":" + second;
           //
           //Hour = uniStormSystem.GetComponent().hourCounter;
           //
           uniStormSystem.GetComponent().dayCounter = TimeManager.Instance.Day;
           //
           uniStormSystem.GetComponent().hourCounter = TimeManager.Instance.Hour;
           //
           uniStormSystem.GetComponent().minuteCounter = TimeManager.Instance.Minute;
           //
       }
       //
   }
   //
}

Link to comment
Share on other sites

  • 2 months later...


class ChangeWeather implements Runnable{

	@Override
	public void run() {
		// TODO Auto-generated method stub
		int percent = GetRandom(0, 100);

		if(Month == 12)
		{
			if(percent <= 25 || forceWeatherChange >= 4){
				weather = GetRandom(1, 11);

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}

		forceWeatherChange++;
	}

}

 

That code right there generates the weather. You would have to finish filling it out for every month as at the moment it only handles December. With that you can give each month it's own percentage chance of changing weather.

 

Here is the actual code I am using which handles all months grouped in seasons. Each month has it's own chances of storms and storms progress in natural fashion from cloudy to foggy to light precip to heavier precip and at any stage there is a chance it clears up and never advances any further. It creates a very realistic weather system.


class ChangeWeather implements Runnable{

	@Override
	public void run() {
		// TODO Auto-generated method stub
		int percent = GetRandom(0, 100);
		int advance = 0;

		if(Month == 1 || Month == 2 || Month == 3 || Month == 11 || Month == 12)
		{
			season = Seasons.Winter;
			Temperature = 32;

			if(percent <= 45 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = 7;
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = 7;
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = 7;
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = 7;
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 4 || Month == 5)
		{
			season = Seasons.Spring;
			Temperature = 60;
			if(percent <= 90 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 6 || Month == 7 || Month == 8)
		{
			season = Seasons.Summer;
			Temperature = 90;
			if(percent <= 75 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 9 || Month == 10)
		{
			season = Seasons.Fall;
			Temperature = 50;
			if(percent <= 40 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}

		forceWeatherChange++;
	}

}

Link to comment
Share on other sites

You will need the Server side Plugin code which everyone should now have access to. You will need to create a whole new Plugin in your server project and set it up to load with the server.

 

Here is my full EnvironmentPlugin class.


package MMOI.agis.plugins;

import java.io.Serializable;
import java.sql.Time;
import java.util.ArrayList;
import java.util.Calendar;
import java.util.HashMap;
import java.util.Random;
import java.util.concurrent.TimeUnit;
import java.util.concurrent.locks.Lock;

import com.sun.javafx.collections.MappingChange.Map;
import com.sun.xml.internal.bind.v2.schemagen.xmlschema.List;

import atavism.msgsys.Message;
import atavism.msgsys.MessageTypeFilter;
import atavism.server.engine.*;
import atavism.server.plugins.WorldManagerClient;
import atavism.server.plugins.WorldManagerClient.ExtensionMessage;
import atavism.server.plugins.WorldManagerClient.TargetedExtensionMessage;
import atavism.server.util.LockFactory;
import atavism.server.util.Log;
import atavism.server.util.Logger;

public class EnvironmentPlugin extends EnginePlugin {
public static int CYCLE_SPEED = 7200;

public EnvironmentPlugin(){
	super(ENVIRONMENT_PLUGIN_NAME);
	setPluginType("Environment");
}

public static String ENVIRONMENT_PLUGIN_NAME = "EnvironmentPlugin";

//protected static final Logger log = new Logger("EnvironmentPlugin");
protected static Lock lock = LockFactory.makeLock("EnvironmentPlugin");

public String getName() {
	return ENVIRONMENT_PLUGIN_NAME;
}

public void onActivate(){
	seconds = 3600;
	Calendar cal = Calendar.getInstance();
	Month = 1;
	Day = 1;
	Year = 1000;
	registerHooks();

}

protected void registerHooks(){
	getHookManager().addHook(WorldManagerClient.MSG_TYPE_SPAWNED,
			 new SpawnedHook());

	MessageTypeFilter filter = new MessageTypeFilter();
       filter.addType(WorldManagerClient.MSG_TYPE_SPAWNED);
       Engine.getAgent().createSubscription(filter, this);

	Engine.getExecutor().scheduleAtFixedRate(envTick, 0, 1, TimeUnit.SECONDS);
	Engine.getExecutor().scheduleAtFixedRate(envSync, 0, 5, TimeUnit.SECONDS);
	Engine.getExecutor().scheduleAtFixedRate(changeWeather, 0, 15, TimeUnit.MINUTES);

	Log.debug("EnvironmentPlugin.onActivate() completed");
}

class SpawnedHook implements Hook  {

	@Override
	public boolean processMessage(Message msg, int arg1) {
		// TODO Auto-generated method stub
		WorldManagerClient.SpawnedMessage spawnedMsg = (WorldManagerClient.SpawnedMessage) msg;
           OID objOid = spawnedMsg.getSubject();

           if(!Oids.contains(objOid))
           	Oids.add(objOid);

           HashMap props = new HashMap();
           props.put("ext_msg_subtype", "Env.Sync");
           props.put("startTime", startTime);
           props.put("year", Year);
           props.put("month", Month);
           props.put("day", Day);
           props.put("weather", weather);
           props.put("cycle_speed", CYCLE_SPEED);
           props.put("temp", Temperature);
           TargetedExtensionMessage _msg = new TargetedExtensionMessage(WorldManagerClient.MSG_TYPE_EXTENSION, objOid, objOid, false, props);
           Engine.getAgent().sendBroadcast(_msg);

		return true;
	}

}

ArrayList Oids = new ArrayList();

float Hour;
float startTime;
float dayLengthHour = 6;
float nightLengthHour = 18;
float dayLength = 10;
float nightLength = 10;
float Milisecond = 1;
float SECOND = 1;
float MINUTE = SECOND * 60;
float HOUR = MINUTE * 60;
float DAY = HOUR * 24;
float seconds = 1;
int Month;
int Day;
int Year;
int weather = 8;
float Temperature = 0f;

int GetRandom(int minimum, int maximum){
	return minimum + (int)(Math.random() * maximum);
}

class EnvironmentTick implements Runnable{

	@Override
	public void run() {
		seconds = seconds + 1;

		if(startTime >= 1)
		{
			seconds = 0;
			Day++;
			if(Day > 30)
			{
				Day = 0;
				Month++;
				if(Month > 12)
				{
					Month = 1;
					Year++;
				}
			}
		}
		startTime = (seconds / CYCLE_SPEED);
	}

}

class EnvironmentSync implements Runnable{

	@Override
	public void run() {
		for (int i = 0; i < Oids.size(); i++) {
			OID objOid = Oids.get(i);

            HashMap props = new HashMap();
            props.put("ext_msg_subtype", "Env.Sync");
            props.put("startTime", startTime);
            props.put("year", Year);
            props.put("month", Month);
            props.put("day", Day);
            props.put("weather", weather);
            props.put("cycle_speed", CYCLE_SPEED);
            props.put("temp", Temperature);
            TargetedExtensionMessage _msg = new TargetedExtensionMessage(WorldManagerClient.MSG_TYPE_EXTENSION, objOid, objOid, false, props);
            Engine.getAgent().sendBroadcast(_msg);
		}
	}
}

class GetDate implements Runnable{

	@Override
	public void run() {
		Calendar cal = Calendar.getInstance();
		// TODO Auto-generated method stub
		Month = cal.get(Calendar.MONTH) + 1;
		Day = cal.get(Calendar.DAY_OF_MONTH);
		Year = cal.get(Calendar.YEAR);
	}

}

void BroadcastWeatherEvent(){
	for (int i = 0; i < Oids.size(); i++) {
		OID objOid = Oids.get(i);

           HashMap props = new HashMap();
           props.put("ext_msg_subtype", "Env.WeatherGenerated");
           props.put("weather", weather);
           TargetedExtensionMessage _msg = new TargetedExtensionMessage(WorldManagerClient.MSG_TYPE_EXTENSION, objOid, objOid, false, props);
           Engine.getAgent().sendBroadcast(_msg);
	}
}

int forceWeatherChange = 0;
enum Seasons{
	Winter,
	Spring,
	Summer,
	Fall
}

Seasons season = Seasons.Winter;

class ChangeWeather implements Runnable{

	@Override
	public void run() {
		// TODO Auto-generated method stub
		int percent = GetRandom(0, 100);
		int advance = 0;

		if(Month == 1 || Month == 2 || Month == 3 || Month == 11 || Month == 12)
		{
			season = Seasons.Winter;
			Temperature = 32;

			if(percent <= 45 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = 7;
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = 7;
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = 7;
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = 7;
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 4 || Month == 5)
		{
			season = Seasons.Spring;
			Temperature = 60;
			if(percent <= 90 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 6 || Month == 7 || Month == 8)
		{
			season = Seasons.Summer;
			Temperature = 90;
			if(percent <= 75 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}
		else if(Month == 9 || Month == 10)
		{
			season = Seasons.Fall;
			Temperature = 50;
			if(percent <= 40 || forceWeatherChange >= 4){
				if(weather == 1)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 2;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 2)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather == 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 3;
					else
						weather = GetRandom(4, 6);
				}
				else if(weather > 3)
				{
					advance = GetRandom(0, 100);

					if(advance <= 50)
						weather = 1;
					else
						weather = GetRandom(4, 6);
				}

				BroadcastWeatherEvent();
				forceWeatherChange = 0;
				return;
			}
		}

		forceWeatherChange++;
	}

}

// Environment Tick: Advances the Day/Night Cycles and the Calendar.
EnvironmentTick envTick = new EnvironmentTick();

// Environment Sync: Used for syncing the Cycle with the clients
EnvironmentSync envSync = new EnvironmentSync();

// Change Weather: Responsible for Generating Weather
ChangeWeather changeWeather = new ChangeWeather();

}

 

On Client Side I made the UniStorm class a singleton so I could access it from anywhere (Looking at my code I guess this version of it I didn't but usually I do and I would recommend it!). Then I created a EnvironmentHandler class which handles receiving the messages from the server and syncing UniStorm.

 


using UnityEngine;
using System.Collections;
using System.Collections.Generic;

public class EnvironmentHandler : MonoBehaviour {

// Use this for initialization
void Start () {
       NetworkAPI.RegisterExtensionMessageHandler("Env.Sync", HandleSync);
       NetworkAPI.RegisterExtensionMessageHandler("Env.WeatherGenerated", this.HandleWeatherGenerated);
   }

// Update is called once per frame
void Update () {

}

   void HandleSync(Dictionary props)
   {
       float startTime = (float)props["startTime"];
       int year = (int)props["year"];
       int month = (int)props["month"];
       int day = (int)props["day"];
       int weather = (int)props["weather"];
       int cycle_speed = (int)props["cycle_speed"];
       float temp = (float)props["temp"];
       StartCoroutine(DoSync(startTime, year, month, day, weather, cycle_speed, temp));
   }

   void HandleWeatherGenerated(Dictionary props)
   {
       int weather = (int)props["weather"];
       UniStormWeatherSystem_C uniStorm = GameObject.FindObjectOfType();
       if (uniStorm != null)
       {
           uniStorm.weatherForecaster = weather;
           //Debug.LogError("Generated Weather: " + weather.ToString());
       }
       else
       {
           //Debug.LogError("UNISTORM not found!");
       }
   }

   IEnumerator DoSync(float startTime, int year, int month, int day, int weather, int speed, float temp)
   {
       yield return new WaitForSeconds(0.1f);

       UniStormWeatherSystem_C uniStorm = GameObject.FindObjectOfType();
       if(uniStorm != null)
       {
           uniStorm.startTime = startTime;
           uniStorm.yearCounter = year;
           uniStorm.monthCounter = month;
           uniStorm.dayCounter = day;
           uniStorm.weatherForecaster = weather;
           UniStormWeatherSystem_C.CYCLE_SPEED = speed;
           uniStorm.temperature = (int)temp;
       }
       else
       {
           //Debug.LogError("UNISTORM not found!");
       }
   }
}


 

I made a generic script which has the gameobject it's attached to follow the player so then I could attach it to the UniStorm base object and it will follow the player around. Something like is only needed for larger seamless worlds. If you have smaller zones then depending on the size of your zones you shouldn't have any issue just centering UniStorm on your zone. For this script all I did was get the Object's Transform and the Player's Transform and set the Object's transform position to that of the player's transform position every frame. Or you could even put it inside a repeated invoke method and invoke it every few seconds though I haven't tested it to see if the jump would be noticeable.

 

How I have everything else set up I'm honestly not sure. It's been a while. I've upgraded to the latest version of Unity and so I've been unable to do anything with Atavism since. Andrew just posted a fix but I believe it's for the latest test release of Atavism 2.7 which until the known bugs are dealt with I'm not willing to upgrade to it yet. With the latest stable version of Atavism there is all kinds of issues with UMA with the latest release of Unity.

Link to comment
Share on other sites

  • 1 month later...
  • 3 months later...

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
 Share

  • Recommended Cloud Solution


    northnetworking.com

×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.