UI: character menu & build mode panel
Continuing with the UI, I have decided to implement a brand new character menu that includes all the player stats, player model and item slots for your dressing needs (will be implemented in the future). You can rotate your player model with the script that is provided below. New character menu I have also changed the looks of the Build mode to make it as simple as possible. New build mode outlook
Generic mouse swipe script
It is time to give away some code for those in need of a solution when you want to do something with the mouse gestures, in this case a mouse “swipe” gesture, e.g. you wish to rotate your character model in the character menu with your mouse. The script provided can be used in your projects, free of charge, and can handle multiple things:
Unity Event when moving the mouse in X direction only
Unity Event when moving the mouse in Y direction only
Unity Event when moving the mouse in XY direction
Knowing if the mouse is “down” on the selected raycastable panel
To make things work create a UI panel, hide the image (do not disable the component), select the image as raycastable and add this script. What you have to do now is to populate your Unity events with your custom function calls. Do not forget when calling your function via this script the function getting called must take one (for X or Y only events) or two (XY event) arguments type of float. The last thing is to mark the event as dynamic, see image below. mouse swipe script
using UnityEngine;
using UnityEngine.Events;
using UnityEngine.EventSystems;
namespace Floatlands.UI
{
public class MouseSwiper : MonoBehaviour, IPointerDownHandler, IPointerUpHandler
{
public bool isHoldingDown;
public Vector2 totalDeltaVector;
public Vector2 deltaVector;
private Vector2 prevVector;
private Vector2 startPosition;
private PointerEventData eventData;
[SerializeField]
public SwipeSingleEvent OnSwipeXEvent;
[SerializeField]
public SwipeSingleEvent OnSwipeYEvent;
[SerializeField]
public SwipeDoubleEvent OnSwipeXYEvent;
public void OnPointerDown(PointerEventData eventData)
{
isHoldingDown = true;
startPosition = eventData.pressPosition;
prevVector = startPosition;
this.eventData = eventData;
}
public void OnPointerUp(PointerEventData eventData)
{
isHoldingDown = false;
}
void Update()
{
if (isHoldingDown)
{
Vector2 currentPosition = this.eventData.position;
totalDeltaVector = currentPosition - startPosition;
deltaVector = currentPosition - prevVector;
prevVector = currentPosition;
OnSwipe((int)deltaVector.x, (int)deltaVector.y);
}
else
{
totalDeltaVector = Vector2.zero;
}
}
void OnSwipe(int deltaX, int deltaY)
{
if (OnSwipeXEvent != null)
OnSwipeXEvent.Invoke(deltaX);
if (OnSwipeYEvent != null)
OnSwipeYEvent.Invoke(deltaY);
if (OnSwipeXYEvent != null)
OnSwipeXYEvent.Invoke(deltaX, deltaY);
}
}
[System.Serializable]
public class SwipeSingleEvent : UnityEvent<int> { }
[System.Serializable]
public class SwipeDoubleEvent : UnityEvent<int, int> { }
}
Outfits and speakers
Mito created some outfits concepts for “techies” that would distinguish them from the “farmers”. So this week I was occupied with modeling and weight painting the new outfits. They put more metal pieces on themselves as armour is made of junk pieces of sheet metal. various “techies” outfits After that I modeled propaganda speakers, which will appear in the world. The speakers will emit propaganda messages and other sounds. propaganda speakers
Extra robot concepts
Currently there is only one type of enemy robots. Simple humanoid machines that wield various weapon types (from snipers to grenadiers etc), they roam around and attack anything in sight. In the near future we’ll add sturdy, hard to destroy robots that will challenge the player. In addition, we’ll also add small spider like robots that will be quick and unforgiving with their melee attacks. Those enemies will surely test your aim. You can see the first glimpse of concept sketches below.
a different kind of enemy robots
Mining drone in action
This week I’ve been playing around with drones, particularly “mining” drone which Andrej beautifully modeled. Mining drone will represent a fine touch to resource collecting. Upon destruction its loot will be dropped and ready for collection, which allows the player to gather resources faster. Tweaking its avoidance system makes it fly smootly regardless of any obstacles on its path. Finishing touches were also made for the drill rotation. More nuts and bolts next week.
mining drone in action
NPC battles
Humans are already alive and fighting each other (Farmers vs. Techies). They have 3 different weapons for now: fists, single shot pistol and revolver. They can also melee attack with pistols! NPCs fighting
I also just started working on ‘Hint nodes’, which will have different geometric shapes. Those hint nodes will provide information about the world – safe spots, danger spots, sniper spots and so on. basic gizmos More about Floatlands: website, facebook, twitter, instagram
↧