This file was deleted.

Binary file not shown.

This file was deleted.

This file was deleted.

Binary file not shown.

This file was deleted.

Binary file not shown.

This file was deleted.

@@ -376,12 +376,12 @@ Prefab:
- target: {fileID: 224702317121178312, guid: 53fc67e916d2b714e8f3c53b23a3263b,
type: 2}
propertyPath: m_LocalPosition.x
value: 365.5
value: 507.5
objectReference: {fileID: 0}
- target: {fileID: 224702317121178312, guid: 53fc67e916d2b714e8f3c53b23a3263b,
type: 2}
propertyPath: m_LocalPosition.y
value: 205.5
value: 285.5
objectReference: {fileID: 0}
- target: {fileID: 224702317121178312, guid: 53fc67e916d2b714e8f3c53b23a3263b,
type: 2}
@@ -594,7 +594,7 @@ Prefab:
- target: {fileID: 224922526101309738, guid: 53fc67e916d2b714e8f3c53b23a3263b,
type: 2}
propertyPath: m_LocalPosition.y
value: -39.999985
value: -40.000015
objectReference: {fileID: 0}
- target: {fileID: 224719153558475138, guid: 53fc67e916d2b714e8f3c53b23a3263b,
type: 2}

Large diffs are not rendered by default.

@@ -1,22 +1,21 @@
using UnityEngine;
using UnityEngine.Networking;

public class CameraController : NetworkBehaviour {
[SerializeField]
GameObject cameraRef;

void Start () {
if (!isLocalPlayer) {
Destroy (cameraRef);
}
}

void IAmDead() {
Debug.Log("DEEEEEEAD");
cameraRef.SetActive (false);
}

void Respawn() {
cameraRef.SetActive (true);
}
}
using UnityEngine;
using UnityEngine.Networking;

public class CameraController : NetworkBehaviour {
[SerializeField]
GameObject cameraRef;

void Start () {
if (!isLocalPlayer) {
Destroy (cameraRef);
}
}

public void DeactivateCamera() {
cameraRef.SetActive (false);
}

public void ActivateCamera() {
cameraRef.SetActive (true);
}
}
@@ -113,12 +113,12 @@ public class CharacterAnimatorController : NetworkBehaviour {

void IAmDead() {
netAnimator.SetTrigger("Dead");
Utils.SetRagdoll(true, gameObject);
Utils.SetRagdoll(true, gameObject, "Weapon");
}

void Respawn() {
netAnimator.SetTrigger("Respawn");
Utils.SetRagdoll(false, gameObject);
Utils.SetRagdoll(false, gameObject, "Weapon");
}

IEnumerator ResetDodge() {
@@ -1,22 +1,12 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterSoundManager : MonoBehaviour {

//[SerializeField]
//List<AudioClip> footsteps = new List<AudioClip>();
//Animator animator;

void Start() {
//animator = GetComponent<Animator> ();
}

void FootDown() {
// foreach (var clip in animator.GetCurrentAnimatorClipInfo(0)) {
// if (clip.weight > 0.5f) {
// AudioSource.PlayClipAtPoint (footsteps [Random.Range (0, footsteps.Count)], transform.position);
// }
// }
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

public class CharacterSoundManager : MonoBehaviour {
[SerializeField]
List<AudioClip> footsteps = new List<AudioClip>();

void FootDown() {
AudioSource.PlayClipAtPoint(footsteps [Random.Range (0, footsteps.Count)], transform.position);
}
}
@@ -1,69 +1,70 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public enum WeaponType {
None,
Sword_Shield,
THSword,
Axe
}

[System.Serializable]
public enum AttackState {
None,
Attacking
}

public class CombatHandler : MonoBehaviour {

WeaponType currentWeapon = WeaponType.None;
AttackState attackState;

int damage = 25;

void Start() {
changeWeapon(WeaponType.Sword_Shield);
}

void OnDestroy() {
}

void UpdateDamage(object arg) {
damage = (int)arg;
}

void UpdateTarget(object arg) {
if (arg == null)
return;

GameObject target = arg as GameObject;
if (attackState == AttackState.Attacking) {
target.SendMessage("GotHit", damage);
}
}

void SendEvent(string eventName) {
//if (eventName == "toStrike") {
// if (target != null) {
// target.SendMessage("GotHit", damage);
// }
//}
}

void AttackBegin() {
attackState = AttackState.Attacking;
}

void AttackEnd() {
attackState = AttackState.None;
}

void changeWeapon(WeaponType to) {
if (to == currentWeapon)
return;
currentWeapon = to;
SendMessage("WeaponChanged", currentWeapon, SendMessageOptions.DontRequireReceiver);
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[System.Serializable]
public enum WeaponType {
None,
Sword_Shield,
THSword,
Axe
}

[System.Serializable]
public enum AttackState {
None,
Attacking
}

public class CombatHandler : MonoBehaviour {

WeaponType currentWeapon = WeaponType.None;
AttackState attackState;

int damage = 25;

void Start() {
changeWeapon(WeaponType.Sword_Shield);
}

void OnDestroy() {
}

void UpdateDamage(object arg) {
damage = (int)arg;
}

void UpdateTarget(object arg) {
if (arg == null)
return;

GameObject target = arg as GameObject;
var super = Utils.GetSuperParent (target.transform);
if (attackState == AttackState.Attacking && super != gameObject) {
target.SendMessage("GotHit", damage);
}
}

void SendEvent(string eventName) {
//if (eventName == "toStrike") {
// if (target != null) {
// target.SendMessage("GotHit", damage);
// }
//}
}

void AttackBegin() {
attackState = AttackState.Attacking;
}

void AttackEnd() {
attackState = AttackState.None;
}

void changeWeapon(WeaponType to) {
if (to == currentWeapon)
return;
currentWeapon = to;
SendMessage("WeaponChanged", currentWeapon, SendMessageOptions.DontRequireReceiver);
}
}
@@ -8,11 +8,14 @@ public class RecursiveTagSetter : MonoBehaviour {

static void SetTagTo(GameObject go, string tag, string ignore) {
go.tag = tag;
foreach (Transform child in go.transform) {
SetTagTo (child.gameObject, tag, ignore);
}
}

[MenuItem("GameObject/Utils/TagSetter")]
static void CreateCustomGameObject(MenuCommand menuCommand)
{
SetTagTo (Selection.activeGameObject, Selection.activeGameObject.tag, "Weapon");
SetTagTo (Selection.activeObject as GameObject, Selection.activeGameObject.tag, "Weapon");
}
}
@@ -1,6 +1,6 @@
[System.Serializable]
public class MatchSettings {

public float respawnTime = 3.0f;

}
[System.Serializable]
public class MatchSettings {

public float respawnTime = 5.0f;

}
@@ -4,6 +4,7 @@
using UnityEngine.Networking;

[RequireComponent(typeof(PlayerSetup))]
[RequireComponent(typeof(CameraController))]
public class Player : NetworkBehaviour {

[SyncVar]
@@ -26,7 +27,7 @@ public class Player : NetworkBehaviour {

public void Setup () {
if (isLocalPlayer) {
GameManager.instance.SetSceneCameraActive (false);
SetPlayerCamera ();
PlayerUIController.Setup ();
}

@@ -98,9 +99,7 @@ public class Player : NetworkBehaviour {
col.enabled = false;
}

if (isLocalPlayer) {
GameManager.instance.SetSceneCameraActive (true);
}
Invoke ("SetSceneCamera", GameManager.instance.matchSettings.respawnTime - 2.0f);

Debug.Log (transform.name + " now dead");
StartCoroutine (RespawnPlayer ());
@@ -128,4 +127,14 @@ public class Player : NetworkBehaviour {
Debug.LogError (e);
}
}

void SetPlayerCamera() {
GameManager.instance.SetSceneCameraActive (false);
GetComponent<CameraController> ().ActivateCamera ();
}

void SetSceneCamera() {
GameManager.instance.SetSceneCameraActive (true);
GetComponent<CameraController> ().DeactivateCamera ();
}
}
@@ -21,21 +21,21 @@ public static class Utils {
return parent;
}

public static void SetKinematic(Transform tf, bool val) {
public static void SetKinematic(Transform tf, bool val, string ignoreTag = "NONE") {
Rigidbody rb = tf.GetComponent<Rigidbody>();
Collider col = tf.GetComponent<Collider>();
if (rb && col) {
if (rb && col && tf.tag != ignoreTag) {
rb.isKinematic = val;
col.isTrigger = val;
}

for (int i = 0; i < tf.childCount; ++i) {
SetKinematic(tf.GetChild(i), val);
SetKinematic(tf.GetChild(i), val, ignoreTag);
}
}

public static void SetRagdoll(bool val, GameObject go) {
SetKinematic(go.transform, !val);
public static void SetRagdoll(bool val, GameObject go, string ignoreTag = "NONE") {
SetKinematic(go.transform, !val, ignoreTag);

Collider col = go.GetComponent<Collider>();
col.isTrigger = val;
@@ -1,35 +1,35 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(Collider))]
public class TriggedHandler : MonoBehaviour {

ZombieAI ai;
int distanceToParent = 0;

void Awake() {
GetComponent<Rigidbody>().isKinematic = true;

Transform parent = Utils.GetSuperParent(transform, out distanceToParent);
ai = parent.GetComponent<ZombieAI>();
}

void OnTriggerEnter(Collider other) {
if (ai)
ai.OnTriggerEnter(other);
}

void OnTriggerExit(Collider other) {
if (ai)
ai.OnTriggerExit(other);
}

void GotHit(int damage) {
if (ai) {
int dmg = distanceToParent == 0 ? damage : damage / distanceToParent;
ai.gameObject.SendMessage("GotHit", dmg);
}
}
}
using System.Collections;
using System.Collections.Generic;
using UnityEngine;

[RequireComponent(typeof(Rigidbody))]
[RequireComponent(typeof(Collider))]
public class TriggedHandler : MonoBehaviour {

Transform parent;
int distanceToParent = 0;

void Awake() {
GetComponent<Rigidbody>().isKinematic = true;

parent = Utils.GetSuperParent(transform, out distanceToParent);
//ai = parent.GetComponent<ZombieAI>();
}

// void OnTriggerEnter(Collider other) {
// if (parent)
// parent.SendMessage("OnTriggerEnter", other);
// }
//
// void OnTriggerExit(Collider other) {
// if (parent)
// parent.SendMessage("OnTriggerExit", other);
// }

void GotHit(int damage) {
if (parent) {
int dmg = distanceToParent == 0 ? damage : damage / distanceToParent;
parent.gameObject.SendMessage("GotHit", dmg);
}
}
}
@@ -1,22 +1,57 @@
<Properties RefactoringSettings.EnableRefactorings="True" StartupConfiguration="{9C335827-BB19-5725-9409-A47A25D59F5A}|">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets/Scripts/Character/NewAttackController.cs">
<Files>
<File FileName="Assets/Scripts/Network/Player.cs" Line="10" Column="21" />
<File FileName="Assets/Scripts/UI/PlayerUIController.cs" Line="28" Column="12" />
<File FileName="Assets/Scripts/Common/InputControl.cs" Line="7" Column="69" />
<File FileName="Assets/Scripts/Character/NewAttackController.cs" Line="15" Column="12" />
<File FileName="Assets/Scripts/Network/PlayerSetup.cs" Line="44" Column="32" />
<File FileName="Assets/Scripts/Character/CharacterSoundManager.cs" Line="12" Column="1" />
<File FileName="Assets/Scripts/Common/CombatHandler.cs" Line="26" Column="12" />
</Files>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore>
<Breakpoint file="C:\Users\Artem\Documents\ThirdPerson\Assets\Scripts\Character\CharacterSoundManager.cs" line="18" column="1" />
</BreakpointStore>
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MultiItemStartupConfigurations />
<MonoDevelop.Ide.ItemProperties.ThirdPerson PreferredExecutionTarget="Unity.Editor" />
<Properties RefactoringSettings.EnableRefactorings="True" StartupConfiguration="{9C335827-BB19-5725-9409-A47A25D59F5A}|" StartupItem="Assembly-CSharp.csproj">
<MonoDevelop.Ide.Workbench ActiveDocument="Assets\Scripts\Network\MatchSettings.cs">
<Files>
<File FileName="Assets\Scripts\Utils\Utils.cs" Line="25" Column="47" />
<File FileName="Assets\Scripts\Weapons\MainWeapon.cs" Line="23" Column="1" />
<File FileName="Assets\Scripts\Camera\CameraController.cs" Line="18" Column="9" />
<File FileName="Assets\Scripts\Network\Player.cs" Line="109" Column="75" />
<File FileName="Assets\Scripts\Zombie\TriggedHandler.cs" Line="32" Column="1" />
<File FileName="Assets\Scripts\Common\CombatHandler.cs" Line="42" Column="55" />
<File FileName="Assets\Scripts\Network\MatchSettings.cs" Line="4" Column="30" />
</Files>
<Pads>
<Pad Id="ProjectPad">
<State name="__root__">
<Node name="ThirdPerson" expanded="True">
<Node name="Assembly-CSharp" expanded="True">
<Node name="Scripts" expanded="True">
<Node name="Camera" expanded="True" />
<Node name="Character" expanded="True" />
<Node name="Common" expanded="True" />
<Node name="Network" expanded="True">
<Node name="MatchSettings.cs" selected="True" />
</Node>
<Node name="Utils" expanded="True" />
<Node name="Weapons" expanded="True" />
<Node name="Zombie" expanded="True" />
</Node>
</Node>
<Node name="Assembly-CSharp-Editor" expanded="True">
<Node name="Scripts" expanded="True">
<Node name="Editor" expanded="True" />
</Node>
</Node>
</Node>
</State>
</Pad>
<Pad Id="MonoDevelop.Debugger.WatchPad">
<State>
<Value>tf.tag</Value>
<Value>tf.name</Value>
</State>
</Pad>
<Pad Id="MonoDevelop.NUnit.TestPad">
<State name="__root__">
<Node name="ThirdPerson" expanded="True" selected="True" />
</State>
</Pad>
</Pads>
</MonoDevelop.Ide.Workbench>
<MonoDevelop.Ide.Workspace ActiveConfiguration="Debug" PreferredExecutionTarget="Unity.Instance.Unity Editor" />
<MonoDevelop.Ide.DebuggingService.Breakpoints>
<BreakpointStore />
</MonoDevelop.Ide.DebuggingService.Breakpoints>
<MonoDevelop.Ide.DebuggingService.PinnedWatches />
<MultiItemStartupConfigurations />
<MonoDevelop.Ide.ItemProperties.ThirdPerson PreferredExecutionTarget="Unity.Editor" />
</Properties>