Implemented shout bubbles

Signed-off-by: RosimInc <rosim_inc@hotmail.com>
This commit is contained in:
RosimInc 2015-08-16 21:50:26 -04:00
parent 6a8f4124df
commit d798ff166c
7 changed files with 316 additions and 20 deletions

View File

@ -17,6 +17,23 @@ GameObject:
m_NavMeshLayer: 0 m_NavMeshLayer: 0
m_StaticEditorFlags: 0 m_StaticEditorFlags: 0
m_IsActive: 1 m_IsActive: 1
--- !u!1 &138142
GameObject:
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
serializedVersion: 4
m_Component:
- 4: {fileID: 495284}
- 33: {fileID: 3383236}
- 23: {fileID: 2397622}
m_Layer: 0
m_Name: BloodSplatter
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!1 &147480 --- !u!1 &147480
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -28,7 +45,7 @@ GameObject:
- 33: {fileID: 3395424} - 33: {fileID: 3395424}
- 23: {fileID: 2372840} - 23: {fileID: 2372840}
m_Layer: 0 m_Layer: 0
m_Name: BloodSplatter m_Name: ShoutBubble
m_TagString: Untagged m_TagString: Untagged
m_Icon: {fileID: 0} m_Icon: {fileID: 0}
m_NavMeshLayer: 0 m_NavMeshLayer: 0
@ -98,9 +115,10 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 193868} m_GameObject: {fileID: 193868}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: -.133731544, y: -.756275117, z: 0} m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: m_Children:
- {fileID: 495284}
- {fileID: 424146} - {fileID: 424146}
- {fileID: 496448} - {fileID: 496448}
m_Father: {fileID: 0} m_Father: {fileID: 0}
@ -112,11 +130,11 @@ Transform:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 147480} m_GameObject: {fileID: 147480}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1} m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -.0109999999} m_LocalPosition: {x: .800000012, y: .75, z: -.0500000007}
m_LocalScale: {x: 1, y: 1, z: 1} m_LocalScale: {x: .75, y: .75, z: 1}
m_Children: [] m_Children: []
m_Father: {fileID: 410576} m_Father: {fileID: 410576}
m_RootOrder: 0 m_RootOrder: 1
--- !u!4 &476902 --- !u!4 &476902
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -129,6 +147,18 @@ Transform:
m_Children: [] m_Children: []
m_Father: {fileID: 496448} m_Father: {fileID: 496448}
m_RootOrder: 0 m_RootOrder: 0
--- !u!4 &495284
Transform:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 138142}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 0, y: 0, z: -.0109999999}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 410576}
m_RootOrder: 0
--- !u!4 &496448 --- !u!4 &496448
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -142,7 +172,7 @@ Transform:
- {fileID: 476902} - {fileID: 476902}
- {fileID: 498100} - {fileID: 498100}
m_Father: {fileID: 410576} m_Father: {fileID: 410576}
m_RootOrder: 1 m_RootOrder: 2
--- !u!4 &498100 --- !u!4 &498100
Transform: Transform:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -261,6 +291,30 @@ MeshRenderer:
m_CastShadows: 0 m_CastShadows: 0
m_ReceiveShadows: 1 m_ReceiveShadows: 1
m_Materials: m_Materials:
- {fileID: 2100000, guid: 3480ff1ba6e1dea4da6b793db1251755, type: 2}
m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0}
m_UseLightProbes: 1
m_ReflectionProbeUsage: 1
m_ProbeAnchor: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 1
m_ImportantGI: 0
m_AutoUVMaxDistance: .5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingOrder: 0
--- !u!23 &2397622
MeshRenderer:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 138142}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 1
m_Materials:
- {fileID: 2100000, guid: 8c192887af84c6d489323981a0248291, type: 2} - {fileID: 2100000, guid: 8c192887af84c6d489323981a0248291, type: 2}
m_SubsetIndices: m_SubsetIndices:
m_StaticBatchRoot: {fileID: 0} m_StaticBatchRoot: {fileID: 0}
@ -296,6 +350,13 @@ MeshFilter:
m_PrefabInternal: {fileID: 100100000} m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 136744} m_GameObject: {fileID: 136744}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0} m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &3383236
MeshFilter:
m_ObjectHideFlags: 1
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 100100000}
m_GameObject: {fileID: 138142}
m_Mesh: {fileID: 10210, guid: 0000000000000000e000000000000000, type: 0}
--- !u!33 &3387390 --- !u!33 &3387390
MeshFilter: MeshFilter:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1
@ -368,7 +429,8 @@ MonoBehaviour:
KillHoldDuration: 2 KillHoldDuration: 2
xMarkLeft: {fileID: 11439868} xMarkLeft: {fileID: 11439868}
xMarkRight: {fileID: 11422410} xMarkRight: {fileID: 11422410}
bloodSplatter: {fileID: 2372840} bloodSplatter: {fileID: 2397622}
shoutBubble: {fileID: 2372840}
--- !u!114 &11422410 --- !u!114 &11422410
MonoBehaviour: MonoBehaviour:
m_ObjectHideFlags: 1 m_ObjectHideFlags: 1

View File

@ -0,0 +1,165 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 5
m_ObjectHideFlags: 0
m_PrefabParentObject: {fileID: 0}
m_PrefabInternal: {fileID: 0}
m_Name: ShoutBubble
m_Shader: {fileID: 32, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords:
m_LightmapFlags: 5
m_CustomRenderQueue: -1
m_SavedProperties:
serializedVersion: 2
m_TexEnvs:
data:
first:
name: _MainTex
second:
m_Texture: {fileID: 2800000, guid: 856ca562f724d934e89bca0999754c23, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _BumpMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailNormalMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _ParallaxMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _OcclusionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _EmissionMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailMask
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _DetailAlbedoMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
data:
first:
name: _MetallicGlossMap
second:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
data:
first:
name: _Cutoff
second: .5
data:
first:
name: _Shininess
second: .257999986
data:
first:
name: _SrcBlend
second: 1
data:
first:
name: _DstBlend
second: 0
data:
first:
name: _Parallax
second: .0199999996
data:
first:
name: _ZWrite
second: 1
data:
first:
name: _Glossiness
second: .5
data:
first:
name: _BumpScale
second: 1
data:
first:
name: _OcclusionStrength
second: 1
data:
first:
name: _DetailNormalMapScale
second: 1
data:
first:
name: _UVSec
second: 0
data:
first:
name: _EmissionScaleUI
second: 0
data:
first:
name: _Mode
second: 0
data:
first:
name: _Metallic
second: 0
data:
first:
name: _Ratio
second: 0
m_Colors:
data:
first:
name: _EmissionColor
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _Color
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _SpecColor
second: {r: .5, g: .5, b: .5, a: 0}
data:
first:
name: _EmissionColorUI
second: {r: 1, g: 1, b: 1, a: 1}
data:
first:
name: _CompletedColor
second: {r: 0, g: 0, b: 0, a: 0}
data:
first:
name: _RemainingColor
second: {r: 1, g: 1, b: 1, a: 1}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: 3480ff1ba6e1dea4da6b793db1251755
timeCreated: 1439775713
licenseType: Free
NativeFormatImporter:
userData:
assetBundleName:
assetBundleVariant:

View File

@ -43,7 +43,6 @@ namespace DeathBook.Model
link.Awareness += Self.Strategy.GetDeathNoticing(1f /*Friend.Popularity*/, Link.Importance, Self.FriendCount, Self.AwarenessLevel); link.Awareness += Self.Strategy.GetDeathNoticing(1f /*Friend.Popularity*/, Link.Importance, Self.FriendCount, Self.AwarenessLevel);
link.Awareness = Mathf.Min(link.Awareness + deltaTime * 0.1f, 1f);
if (link.Awareness >= 1f) if (link.Awareness >= 1f)
{ {
self.NoticeDeath(this); self.NoticeDeath(this);

View File

@ -1,6 +1,5 @@
using UnityEngine; using UnityEngine;
using System.Collections.Generic; using System.Collections.Generic;
using System;
using DeathBook.Util; using DeathBook.Util;
namespace DeathBook.Model namespace DeathBook.Model
@ -43,6 +42,18 @@ namespace DeathBook.Model
float change = value - awarenessLevel; float change = value - awarenessLevel;
awarenessLevel = value; awarenessLevel = value;
LevelManager.Instance.GameLevel.AddAwareness(change); LevelManager.Instance.GameLevel.AddAwareness(change);
NotifyObservers();
}
}
private static Level level;
private static Level GameLevel
{
get
{
if (level == null)
level = LevelManager.Instance.GameLevel;
return level;
} }
} }
@ -58,8 +69,15 @@ namespace DeathBook.Model
private Sprite picture; private Sprite picture;
public Sprite Picture { get { return picture; } } public Sprite Picture { get { return picture; } }
private Action onSelected; private System.Action onSelected;
public Action OnSelected {get {return onSelected;} set { onSelected = value; } } public System.Action OnSelected {get {return onSelected;} set { onSelected = value; } }
private Status status = null;
public Status CurrentStatus
{
get { return status; }
set { status = value; NotifyObservers(); }
}
private GameStrategy strategy; private GameStrategy strategy;
public GameStrategy Strategy public GameStrategy Strategy
@ -110,30 +128,32 @@ namespace DeathBook.Model
//Debug.Log("Person " + id + " died!"); //Debug.Log("Person " + id + " died!");
alive = false; alive = false;
if (LevelManager.Instance.GameLevel.tutorialInt == 4) if (GameLevel.tutorialInt == 4)
LevelManager.Instance.GameLevel.allowNext = true; GameLevel.allowNext = true;
foreach (Friendship f in friendsList) foreach (Friendship f in friendsList)
f.Other.NotifyFriendWasKilled(); f.Other.NotifyFriendWasKilled();
NotifyObservers(); NotifyObservers();
LevelManager.Instance.GameLevel.RegisterKill(this); GameLevel.RegisterKill(this);
return true; return true;
} }
public void NoticeDeath(Friendship f) public void NoticeDeath(Friendship f)
{ {
int deathTime = LevelManager.Instance.GameLevel.GameTime; int deathTime = GameLevel.GameTime;
int sinceLastDeath = numDeadFriends == 0 ? int.MaxValue/2 : deathTime - lastFriendDeath; int sinceLastDeath = numDeadFriends == 0 ? int.MaxValue/2 : deathTime - lastFriendDeath;
float strategyOutput = Strategy.GetAwarenessChange(numDeadFriends, numAliveFriends, sinceLastDeath); float strategyOutput = Strategy.GetAwarenessChange(numDeadFriends, numAliveFriends, sinceLastDeath);
AwarenessLevel = Mathf.Min(AwarenessLevel + strategyOutput, 1f); AwarenessLevel = Mathf.Min(AwarenessLevel + strategyOutput, 1f);
NotifyObservers(); if (Random.value < 0.3f)
{
CurrentStatus = new Status(GameLevel.GameTime, f);
}
//Debug.Log("I am " + id + " and I know my friend " + f.Friend.Id + " was killed.. " + strategyOutput); //Debug.Log("I am " + id + " and I know my friend " + f.Friend.Id + " was killed.. " + strategyOutput);
} }
@ -145,8 +165,35 @@ namespace DeathBook.Model
return !(time < ConnectionTime && time > DisconnectionTime); return !(time < ConnectionTime && time > DisconnectionTime);
} }
private void ShareStatus()
{
if (Random.value < 0.3f)
{
foreach (Friendship f in friendsList)
f.Friend.ReceiveStatus(CurrentStatus);
}
}
public void ReceiveStatus(Status newStatus)
{
Debug.Log("Oh noes, " + newStatus.Friends.Friend + " died...");
/*foreach (Friendship f in friendsList)
{
if (f.Friend == newStatus.Friends) ;
}*/
}
public void Update(float deltaTime) public void Update(float deltaTime)
{ {
if (CurrentStatus != null)
{
if (CurrentStatus.EndTime < GameLevel.GameTime)
{
ShareStatus();
CurrentStatus = null;
}
}
if (!Alive) if (!Alive)
return; return;

View File

@ -2,8 +2,20 @@
namespace DeathBook.Model namespace DeathBook.Model
{ {
public class Status : Post public class Status
{ {
//TODO /*private int startTime;
public int StartTime { get { return startTime; } }*/
private int endTime;
public int EndTime { get { return endTime; } }
private Friendship friends;
public Friendship Friends { get { return friends; } }
public Status(int startTime, Friendship friendship)
{
/*this.startTime = startTime;*/
this.endTime = startTime = (int) Utils.GetRandomValue(60*1.5f, 35, 3);
friends = friendship;
}
} }
} }

View File

@ -23,7 +23,8 @@ public class PersonNode : MonoBehaviour, IObserver
public float KillHoldDuration = 2f; public float KillHoldDuration = 2f;
public RatioProgression xMarkLeft; public RatioProgression xMarkLeft;
public RatioProgression xMarkRight; public RatioProgression xMarkRight;
public Renderer bloodSplatter; public Renderer bloodSplatter;
public Renderer shoutBubble;
private List<Link> _links; private List<Link> _links;
private bool _highlighted = false; private bool _highlighted = false;
@ -157,6 +158,8 @@ public class PersonNode : MonoBehaviour, IObserver
//If dead -> set offline until all friends are aware, then add a big red X to profile pic //If dead -> set offline until all friends are aware, then add a big red X to profile pic
if (_model.Alive) if (_model.Alive)
{ {
shoutBubble.gameObject.SetActive(_model.CurrentStatus != null);
SetColors(); SetColors();
} }
else else