Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions Assets/Animations/Locomotion Pack/JumpUpHigh.fbm.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Editor/CrossPlatformInput.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

139 changes: 139 additions & 0 deletions Assets/Editor/CrossPlatformInput/CrossPlatformInputInitialize.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,139 @@
using System;
using System.Collections.Generic;
using UnityEditor;

namespace UnityStandardAssets.CrossPlatformInput.Inspector
{
[InitializeOnLoad]
public class CrossPlatformInitialize
{
// Custom compiler defines:
//
// CROSS_PLATFORM_INPUT : denotes that cross platform input package exists, so that other packages can use their CrossPlatformInput functions.
// EDITOR_MOBILE_INPUT : denotes that mobile input should be used in editor, if a mobile build target is selected. (i.e. using Unity Remote app).
// MOBILE_INPUT : denotes that mobile input should be used right now!

static CrossPlatformInitialize()
{
var defines = GetDefinesList(buildTargetGroups[0]);
if (!defines.Contains("CROSS_PLATFORM_INPUT"))
{
SetEnabled("CROSS_PLATFORM_INPUT", true, false);
SetEnabled("MOBILE_INPUT", true, true);
}
}


[MenuItem("Mobile Input/Enable")]
private static void Enable()
{
SetEnabled("MOBILE_INPUT", true, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
case BuildTarget.PSM:
case BuildTarget.Tizen:
case BuildTarget.WSAPlayer:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input. You'll need to use the Unity Remote app on a connected device to control your game in the Editor.",
"OK");
break;

default:
EditorUtility.DisplayDialog("Mobile Input",
"You have enabled Mobile Input, but you have a non-mobile build target selected in your build settings. The mobile control rigs won't be active or visible on-screen until you switch the build target to a mobile platform.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Enable", true)]
private static bool EnableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return !defines.Contains("MOBILE_INPUT");
}


[MenuItem("Mobile Input/Disable")]
private static void Disable()
{
SetEnabled("MOBILE_INPUT", false, true);
switch (EditorUserBuildSettings.activeBuildTarget)
{
case BuildTarget.Android:
case BuildTarget.iOS:
EditorUtility.DisplayDialog("Mobile Input",
"You have disabled Mobile Input. Mobile control rigs won't be visible, and the Cross Platform Input functions will always return standalone controls.",
"OK");
break;
}
}


[MenuItem("Mobile Input/Disable", true)]
private static bool DisableValidate()
{
var defines = GetDefinesList(mobileBuildTargetGroups[0]);
return defines.Contains("MOBILE_INPUT");
}


private static BuildTargetGroup[] buildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Standalone,
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.WSA
};

private static BuildTargetGroup[] mobileBuildTargetGroups = new BuildTargetGroup[]
{
BuildTargetGroup.Android,
BuildTargetGroup.iOS,
BuildTargetGroup.PSM,
BuildTargetGroup.SamsungTV,
BuildTargetGroup.Tizen,
BuildTargetGroup.WSA
};


private static void SetEnabled(string defineName, bool enable, bool mobile)
{
//Debug.Log("setting "+defineName+" to "+enable);
foreach (var group in mobile ? mobileBuildTargetGroups : buildTargetGroups)
{
var defines = GetDefinesList(group);
if (enable)
{
if (defines.Contains(defineName))
{
return;
}
defines.Add(defineName);
}
else
{
if (!defines.Contains(defineName))
{
return;
}
while (defines.Contains(defineName))
{
defines.Remove(defineName);
}
}
string definesString = string.Join(";", defines.ToArray());
PlayerSettings.SetScriptingDefineSymbolsForGroup(group, definesString);
}
}


private static List<string> GetDefinesList(BuildTargetGroup group)
{
return new List<string>(PlayerSettings.GetScriptingDefineSymbolsForGroup(group).Split(';'));
}
}
}

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Resources/Materials/grass_texture_four.mat
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Resources/Materials/grass_texture_four.mat.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file added Assets/Scenes/B2_Graphics.unity
Binary file not shown.
8 changes: 8 additions & 0 deletions Assets/Scenes/B2_Graphics.unity.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

9 changes: 9 additions & 0 deletions Assets/Scripts/Scripts_B2.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

131 changes: 131 additions & 0 deletions Assets/Scripts/Scripts_B2/CharacterInput.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,131 @@
using UnityEngine;
using System.Collections;

namespace Character {
public class CharacterInput : MonoBehaviour {

Animator ErikaAnimator;
private float MAX_SPEED = 1.0f;
private float MIN_SPEED = -3.5f;
private float MAX_STRAFE = 0.5f;
private float MIN_STRAFE = -0.5f;
string speedParam = "Speedx";
string directionParam = "Speedz";
bool finishedJump = true;

float speedx = 0.0f;
float speedz = 0.0f;

public enum INPUT_KEY {
FORWARD = KeyCode.W,
BACKWARD = KeyCode.S,
LEFT = KeyCode.A,
RIGHT = KeyCode.D,
DUCK = KeyCode.LeftControl,
JUMP = KeyCode.Space,
RUN = KeyCode.LeftShift,
INVENTORY = KeyCode.I,
MAP = KeyCode.M,
FOCUS_LOOK = KeyCode.Mouse1, // secondary mouse button
CONTEXT_ACTION = KeyCode.Mouse1,
SELECT_AGENT = KeyCode.Mouse0,
FREE_CAM = KeyCode.F1,
THIRD_CAM = KeyCode.F2,
FIRST_CAM = KeyCode.F3
}

// Use this for initialization
void Start () {
ErikaAnimator = gameObject.GetComponent<Animator> ();
}

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

// forward motion
if (Input.GetKey ((KeyCode)INPUT_KEY.FORWARD) && Input.GetKey ((KeyCode)INPUT_KEY.RUN)) {
speedx += 0.01f;
MAX_SPEED = 1;
}
else if (Input.GetKey ((KeyCode)INPUT_KEY.FORWARD)) {
//ErikaAnimator.SetFloat (directionParam, 1);
speedx +=0.01f;
MAX_SPEED = 0.5f;
} else if (Input.GetKey ((KeyCode)INPUT_KEY.BACKWARD)) {
speedx -= 0.01f;
MIN_SPEED = -0.5f;
}
else
{
MIN_SPEED = 0.0f;
MAX_SPEED = 0.0f;
if (speedx > 0) {
speedx -= 0.01f;
} else {
speedx += 0.01f;
}

}

// turning
if (Input.GetKey ((KeyCode)INPUT_KEY.LEFT))
{
MAX_STRAFE = 0.5f;
speedz += 0.01f;
}
else if (Input.GetKey ((KeyCode)INPUT_KEY.RIGHT))
{
MIN_STRAFE = -0.5f;
speedz -= 0.01f;
}
else
{
MIN_STRAFE = 0.0f;
MAX_STRAFE = 0.0f;
if (speedz > 0) {
speedz -= 0.01f;
} else {
speedz += 0.01f;
}

}

// jumping
if (Input.GetKeyDown((KeyCode)INPUT_KEY.JUMP))
{ // Note we only read jump once

}
if (speedx > MAX_SPEED) {
speedx -= 0.02f;
}
if (speedx < MIN_SPEED) {
speedx += 0.02f;
}
if (speedz > MAX_STRAFE) {
speedz -= 0.02f;
}
if (speedz < MIN_STRAFE) {
speedz += 0.02f;
}

if (Input.GetKey ((KeyCode)INPUT_KEY.JUMP))
{
if (speedx > 0.5f) {
ErikaAnimator.SetTrigger ("RunJump");
} else if (speedx > 0.3f) {
ErikaAnimator.SetTrigger ("Jump");
} else {
ErikaAnimator.SetTrigger ("IdleJump");
}
print (ErikaAnimator.GetBool ("FinishedJump"));
ErikaAnimator.SetBool ("FinishedJump", true);
print (ErikaAnimator.GetBool ("FinishedJump"));
}

Debug.Log(ErikaAnimator.GetFloat(directionParam));
ErikaAnimator.SetFloat (speedParam, speedx);
ErikaAnimator.SetFloat (directionParam, speedz);

}
}
}
12 changes: 12 additions & 0 deletions Assets/Scripts/Scripts_B2/CharacterInput.cs.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Binary file not shown.

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions Assets/Standard Assets/Cameras.meta

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading