mirror of
https://github.com/ConjureETS/PillowFight.git
synced 2026-03-24 00:50:59 +00:00
Add visual cue for selectable pillows
This commit is contained in:
parent
3da3a00efc
commit
af0053f169
BIN
Assets/Art/Materials/T_Sol_D.mat
Normal file
BIN
Assets/Art/Materials/T_Sol_D.mat
Normal file
Binary file not shown.
8
Assets/Art/Materials/T_Sol_D.mat.meta
Normal file
8
Assets/Art/Materials/T_Sol_D.mat.meta
Normal file
@ -0,0 +1,8 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 9d4b1c409597959428bf32694eae2f5b
|
||||||
|
timeCreated: 1440311586
|
||||||
|
licenseType: Free
|
||||||
|
NativeFormatImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Art/SM_Sol.FBX
Normal file
BIN
Assets/Art/SM_Sol.FBX
Normal file
Binary file not shown.
74
Assets/Art/SM_Sol.FBX.meta
Normal file
74
Assets/Art/SM_Sol.FBX.meta
Normal file
@ -0,0 +1,74 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: a52f33b80c0394f4d819fcf4d339242f
|
||||||
|
timeCreated: 1440311586
|
||||||
|
licenseType: Free
|
||||||
|
ModelImporter:
|
||||||
|
serializedVersion: 18
|
||||||
|
fileIDToRecycleName:
|
||||||
|
100000: //RootNode
|
||||||
|
400000: //RootNode
|
||||||
|
2300000: //RootNode
|
||||||
|
3300000: //RootNode
|
||||||
|
4300000: Object001
|
||||||
|
materials:
|
||||||
|
importMaterials: 1
|
||||||
|
materialName: 0
|
||||||
|
materialSearch: 1
|
||||||
|
animations:
|
||||||
|
legacyGenerateAnimations: 4
|
||||||
|
bakeSimulation: 0
|
||||||
|
optimizeGameObjects: 0
|
||||||
|
motionNodeName:
|
||||||
|
animationImportErrors:
|
||||||
|
animationImportWarnings:
|
||||||
|
animationRetargetingWarnings:
|
||||||
|
animationDoRetargetingWarnings: 0
|
||||||
|
animationCompression: 1
|
||||||
|
animationRotationError: .5
|
||||||
|
animationPositionError: .5
|
||||||
|
animationScaleError: .5
|
||||||
|
animationWrapMode: 0
|
||||||
|
extraExposedTransformPaths: []
|
||||||
|
clipAnimations: []
|
||||||
|
isReadable: 1
|
||||||
|
meshes:
|
||||||
|
lODScreenPercentages: []
|
||||||
|
globalScale: 1
|
||||||
|
meshCompression: 0
|
||||||
|
addColliders: 0
|
||||||
|
importBlendShapes: 1
|
||||||
|
swapUVChannels: 0
|
||||||
|
generateSecondaryUV: 0
|
||||||
|
useFileUnits: 1
|
||||||
|
optimizeMeshForGPU: 1
|
||||||
|
keepQuads: 0
|
||||||
|
weldVertices: 1
|
||||||
|
secondaryUVAngleDistortion: 8
|
||||||
|
secondaryUVAreaDistortion: 15.000001
|
||||||
|
secondaryUVHardAngle: 88
|
||||||
|
secondaryUVPackMargin: 4
|
||||||
|
useFileScale: 1
|
||||||
|
tangentSpace:
|
||||||
|
normalSmoothAngle: 60
|
||||||
|
splitTangentsAcrossUV: 1
|
||||||
|
normalImportMode: 0
|
||||||
|
tangentImportMode: 1
|
||||||
|
importAnimation: 1
|
||||||
|
copyAvatar: 0
|
||||||
|
humanDescription:
|
||||||
|
human: []
|
||||||
|
skeleton: []
|
||||||
|
armTwist: .5
|
||||||
|
foreArmTwist: .5
|
||||||
|
upperLegTwist: .5
|
||||||
|
legTwist: .5
|
||||||
|
armStretch: .0500000007
|
||||||
|
legStretch: .0500000007
|
||||||
|
feetSpacing: 0
|
||||||
|
rootMotionBoneName:
|
||||||
|
lastHumanDescriptionAvatarSource: {instanceID: 0}
|
||||||
|
animationType: 0
|
||||||
|
additionalBone: 0
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
9
Assets/Art/SM_Sol.fbm.meta
Normal file
9
Assets/Art/SM_Sol.fbm.meta
Normal file
@ -0,0 +1,9 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 25a91ea54981fda439e86c33ed716868
|
||||||
|
folderAsset: yes
|
||||||
|
timeCreated: 1440311583
|
||||||
|
licenseType: Free
|
||||||
|
DefaultImporter:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
BIN
Assets/Art/SM_Sol.fbm/T_Sol_D.tga
Normal file
BIN
Assets/Art/SM_Sol.fbm/T_Sol_D.tga
Normal file
Binary file not shown.
|
After Width: | Height: | Size: 12 MiB |
55
Assets/Art/SM_Sol.fbm/T_Sol_D.tga.meta
Normal file
55
Assets/Art/SM_Sol.fbm/T_Sol_D.tga.meta
Normal file
@ -0,0 +1,55 @@
|
|||||||
|
fileFormatVersion: 2
|
||||||
|
guid: 690eeaab4d5368a40ae6ed11e8e8a28b
|
||||||
|
timeCreated: 1440311585
|
||||||
|
licenseType: Free
|
||||||
|
TextureImporter:
|
||||||
|
fileIDToRecycleName: {}
|
||||||
|
serializedVersion: 2
|
||||||
|
mipmaps:
|
||||||
|
mipMapMode: 0
|
||||||
|
enableMipMap: 1
|
||||||
|
linearTexture: 0
|
||||||
|
correctGamma: 0
|
||||||
|
fadeOut: 0
|
||||||
|
borderMipMap: 0
|
||||||
|
mipMapFadeDistanceStart: 1
|
||||||
|
mipMapFadeDistanceEnd: 3
|
||||||
|
bumpmap:
|
||||||
|
convertToNormalMap: 0
|
||||||
|
externalNormalMap: 0
|
||||||
|
heightScale: .25
|
||||||
|
normalMapFilter: 0
|
||||||
|
isReadable: 0
|
||||||
|
grayScaleToAlpha: 0
|
||||||
|
generateCubemap: 0
|
||||||
|
cubemapConvolution: 0
|
||||||
|
cubemapConvolutionSteps: 8
|
||||||
|
cubemapConvolutionExponent: 1.5
|
||||||
|
seamlessCubemap: 0
|
||||||
|
textureFormat: -1
|
||||||
|
maxTextureSize: 2048
|
||||||
|
textureSettings:
|
||||||
|
filterMode: -1
|
||||||
|
aniso: -1
|
||||||
|
mipBias: -1
|
||||||
|
wrapMode: -1
|
||||||
|
nPOTScale: 1
|
||||||
|
lightmap: 0
|
||||||
|
rGBM: 0
|
||||||
|
compressionQuality: 50
|
||||||
|
spriteMode: 0
|
||||||
|
spriteExtrude: 1
|
||||||
|
spriteMeshType: 1
|
||||||
|
alignment: 0
|
||||||
|
spritePivot: {x: .5, y: .5}
|
||||||
|
spriteBorder: {x: 0, y: 0, z: 0, w: 0}
|
||||||
|
spritePixelsToUnits: 100
|
||||||
|
alphaIsTransparency: 0
|
||||||
|
textureType: -1
|
||||||
|
buildTargetSettings: []
|
||||||
|
spriteSheet:
|
||||||
|
sprites: []
|
||||||
|
spritePackingTag:
|
||||||
|
userData:
|
||||||
|
assetBundleName:
|
||||||
|
assetBundleVariant:
|
||||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -1,31 +1,29 @@
|
|||||||
using UnityEngine;
|
using UnityEngine;
|
||||||
using System.Collections;
|
using System.Collections;
|
||||||
|
|
||||||
[RequireComponent(typeof(MeshRenderer))]
|
|
||||||
public class Floor : MonoBehaviour
|
public class Floor : MonoBehaviour
|
||||||
{
|
{
|
||||||
public MomBehavior Mom;
|
public MomBehavior Mom;
|
||||||
public Material NormalMaterial;
|
public Material NormalMaterial;
|
||||||
public Material LavaMaterial;
|
public Material LavaMaterial;
|
||||||
|
|
||||||
private MeshRenderer _renderer;
|
public MeshRenderer Renderer;
|
||||||
|
|
||||||
void Awake()
|
void Awake()
|
||||||
{
|
{
|
||||||
_renderer = GetComponent<MeshRenderer>();
|
|
||||||
Mom.OnEnterRoom += ChangeToNormalFloor;
|
Mom.OnEnterRoom += ChangeToNormalFloor;
|
||||||
Mom.OnLeaveRoom += ChangeToLavaFloor;
|
Mom.OnLeaveRoom += ChangeToLavaFloor;
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeToNormalFloor()
|
private void ChangeToNormalFloor()
|
||||||
{
|
{
|
||||||
_renderer.material = NormalMaterial;
|
Renderer.material = NormalMaterial;
|
||||||
gameObject.tag = "Floor"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
|
gameObject.tag = "Floor"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
|
||||||
}
|
}
|
||||||
|
|
||||||
private void ChangeToLavaFloor()
|
private void ChangeToLavaFloor()
|
||||||
{
|
{
|
||||||
_renderer.material = LavaMaterial;
|
Renderer.material = LavaMaterial;
|
||||||
gameObject.tag = "Lava"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
|
gameObject.tag = "Lava"; // Might not be necessary since the player is most likely "dead" if he touches a non-lava floor
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
@ -3,25 +3,40 @@ using System.Collections;
|
|||||||
|
|
||||||
public class Pillow : MonoBehaviour {
|
public class Pillow : MonoBehaviour {
|
||||||
|
|
||||||
|
public Color SelectableMinColor;
|
||||||
|
public float LerpDuration = 2f;
|
||||||
|
|
||||||
public bool IsThrown = false;
|
public bool IsThrown = false;
|
||||||
|
|
||||||
private bool IsPickable = true;
|
private bool IsPickable = true;
|
||||||
|
|
||||||
private Collider _col;
|
private Collider _col;
|
||||||
private Rigidbody _rb;
|
private Rigidbody _rb;
|
||||||
|
private MeshRenderer _renderer;
|
||||||
|
|
||||||
private bool _isOwned;
|
private bool _isOwned;
|
||||||
|
private Color _defaultColor;
|
||||||
|
|
||||||
|
private float _ratio = 0f;
|
||||||
|
private bool _lerpingUp = false;
|
||||||
|
|
||||||
public bool IsOwned
|
public bool IsOwned
|
||||||
{
|
{
|
||||||
get { return _isOwned; }
|
get { return _isOwned; }
|
||||||
set { _isOwned = value; }
|
set
|
||||||
|
{
|
||||||
|
_isOwned = value;
|
||||||
|
_renderer.material.color = _defaultColor;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Use this for initialization
|
// Use this for initialization
|
||||||
void Start () {
|
void Start () {
|
||||||
_col = GetComponent<Collider>();
|
_col = GetComponent<Collider>();
|
||||||
_rb = GetComponent<Rigidbody>();
|
_rb = GetComponent<Rigidbody>();
|
||||||
|
_renderer = GetComponent<MeshRenderer>();
|
||||||
|
|
||||||
|
_defaultColor = _renderer.material.color;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update is called once per frame
|
// Update is called once per frame
|
||||||
@ -31,6 +46,27 @@ public class Pillow : MonoBehaviour {
|
|||||||
Destroy(this.gameObject);
|
Destroy(this.gameObject);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (!_isOwned)
|
||||||
|
{
|
||||||
|
_ratio += Time.deltaTime / LerpDuration / 2f;
|
||||||
|
|
||||||
|
if (_lerpingUp)
|
||||||
|
{
|
||||||
|
_renderer.material.color = Color.Lerp(SelectableMinColor, _defaultColor, _ratio);
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_renderer.material.color = Color.Lerp(_defaultColor, SelectableMinColor, _ratio);
|
||||||
|
}
|
||||||
|
|
||||||
|
if (_ratio >= 1f)
|
||||||
|
{
|
||||||
|
_lerpingUp = !_lerpingUp;
|
||||||
|
|
||||||
|
_ratio = 0f;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void OnCollisionEnter(Collision other) {
|
void OnCollisionEnter(Collision other) {
|
||||||
@ -48,6 +84,7 @@ public class Pillow : MonoBehaviour {
|
|||||||
_rb.isKinematic = false;
|
_rb.isKinematic = false;
|
||||||
_col.enabled = true;
|
_col.enabled = true;
|
||||||
_rb.AddForce(force, ForceMode.Impulse);
|
_rb.AddForce(force, ForceMode.Impulse);
|
||||||
|
_renderer.material.color = _defaultColor;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void MakePickable() {
|
public void MakePickable() {
|
||||||
|
|||||||
Binary file not shown.
Loading…
x
Reference in New Issue
Block a user