Skip to content

Commit

Permalink
improve agm deselect behaviour(unlocking), add SFLogo, add deltatime …
Browse files Browse the repository at this point in the history
…to avatarflight, update example scene, hopefully 1.5 release
  • Loading branch information
Sacchan-VRC committed Nov 13, 2021
1 parent b77380e commit 2c8216d
Show file tree
Hide file tree
Showing 12 changed files with 404 additions and 28 deletions.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion SF-1/Materials/SmokeColorIndicator.mat
Original file line number Diff line number Diff line change
Expand Up @@ -75,5 +75,5 @@ Material:
- _UVSec: 0
- _ZWrite: 1
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _Color: {r: 0.64028203, g: 0, b: 0.51511765, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
78 changes: 78 additions & 0 deletions SFLogo.mat
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!21 &2100000
Material:
serializedVersion: 6
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_Name: SFLogo
m_Shader: {fileID: 46, guid: 0000000000000000f000000000000000, type: 0}
m_ShaderKeywords: _ALPHABLEND_ON
m_LightmapFlags: 4
m_EnableInstancingVariants: 0
m_DoubleSidedGI: 0
m_CustomRenderQueue: 3000
stringTagMap:
RenderType: Transparent
disabledShaderPasses: []
m_SavedProperties:
serializedVersion: 3
m_TexEnvs:
- _BumpMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailAlbedoMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailMask:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _DetailNormalMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _EmissionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MainTex:
m_Texture: {fileID: 2800000, guid: 8a1dc42123c997a42926369105b1c22e, type: 3}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _MetallicGlossMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _OcclusionMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ParallaxMap:
m_Texture: {fileID: 0}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
m_Floats:
- _BumpScale: 1
- _Cutoff: 0.5
- _DetailNormalMapScale: 1
- _DstBlend: 10
- _GlossMapScale: 1
- _Glossiness: 0.5
- _GlossyReflections: 1
- _Metallic: 0
- _Mode: 2
- _OcclusionStrength: 1
- _Parallax: 0.02
- _SmoothnessTextureChannel: 0
- _SpecularHighlights: 1
- _SrcBlend: 5
- _UVSec: 0
- _ZWrite: 0
m_Colors:
- _Color: {r: 1, g: 1, b: 1, a: 1}
- _EmissionColor: {r: 0, g: 0, b: 0, a: 1}
8 changes: 8 additions & 0 deletions SFLogo.mat.meta

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

94 changes: 91 additions & 3 deletions SaccFlightExample.unity
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,89 @@ NavMeshSettings:
debug:
m_Flags: 0
m_NavMeshData: {fileID: 0}
--- !u!1 &25901393
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 25901396}
- component: {fileID: 25901395}
- component: {fileID: 25901394}
m_Layer: 0
m_Name: REFCAM
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 0
--- !u!81 &25901394
AudioListener:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25901393}
m_Enabled: 1
--- !u!20 &25901395
Camera:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25901393}
m_Enabled: 1
serializedVersion: 2
m_ClearFlags: 1
m_BackGroundColor: {r: 0.19215687, g: 0.3019608, b: 0.4745098, a: 0}
m_projectionMatrixMode: 1
m_GateFitMode: 2
m_FOVAxisMode: 0
m_SensorSize: {x: 36, y: 24}
m_LensShift: {x: 0, y: 0}
m_FocalLength: 50
m_NormalizedViewPortRect:
serializedVersion: 2
x: 0
y: 0
width: 1
height: 1
near clip plane: 0.3
far clip plane: 100000
field of view: 60
orthographic: 0
orthographic size: 5
m_Depth: 0
m_CullingMask:
serializedVersion: 2
m_Bits: 4294967295
m_RenderingPath: -1
m_TargetTexture: {fileID: 0}
m_TargetDisplay: 0
m_TargetEye: 3
m_HDR: 1
m_AllowMSAA: 1
m_AllowDynamicResolution: 0
m_ForceIntoRT: 0
m_OcclusionCulling: 1
m_StereoConvergence: 10
m_StereoSeparation: 0.022
--- !u!4 &25901396
Transform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 25901393}
m_LocalRotation: {x: 0, y: 0, z: 0, w: 1}
m_LocalPosition: {x: 43.69604, y: 0.913989, z: 112.41576}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 0}
m_RootOrder: 6
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
--- !u!1 &60433031
GameObject:
m_ObjectHideFlags: 0
Expand Down Expand Up @@ -984,6 +1067,11 @@ PrefabInstance:
value:
objectReference: {fileID: 11400000, guid: 40b6c76360409454d8ce13bc3280561b,
type: 2}
- target: {fileID: 6759095419728963412, guid: 8894fa7e4588a5c4fab98453e558847d,
type: 3}
propertyPath: ReferenceCamera
value:
objectReference: {fileID: 25901393}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 8894fa7e4588a5c4fab98453e558847d, type: 3}
--- !u!114 &514701003 stripped
Expand Down Expand Up @@ -5503,17 +5591,17 @@ PrefabInstance:
- target: {fileID: 914079681766072833, guid: 28c8c7914fa9c4d4da592e668b84715a,
type: 3}
propertyPath: m_LocalPosition.x
value: -180.4
value: -101.93
objectReference: {fileID: 0}
- target: {fileID: 914079681766072833, guid: 28c8c7914fa9c4d4da592e668b84715a,
type: 3}
propertyPath: m_LocalPosition.y
value: 9.31
value: 2.83
objectReference: {fileID: 0}
- target: {fileID: 914079681766072833, guid: 28c8c7914fa9c4d4da592e668b84715a,
type: 3}
propertyPath: m_LocalPosition.z
value: 97.71
value: 49
objectReference: {fileID: 0}
- target: {fileID: 914079681766072833, guid: 28c8c7914fa9c4d4da592e668b84715a,
type: 3}
Expand Down
21 changes: 13 additions & 8 deletions Scripts/DFUNC/DFUNC_AGM.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void SFEXT_L_EntityStart()
InEditor = localPlayer == null;
EntityControl = (SaccEntity)SAVControl.GetProgramVariable("EntityControl");
VehicleTransform = EntityControl.transform;
AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider);
if (AGMAnimator) { AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider); }
if (Dial_Funcon) Dial_Funcon.SetActive(false);

FindSelf();
Expand Down Expand Up @@ -124,7 +124,7 @@ public void SFEXT_O_PilotExit()
public void SFEXT_G_RespawnButton()
{
NumAGM = FullAGMs;
AGMAnimator.SetFloat(AnimFloatName, 1);
if (AGMAnimator) { AGMAnimator.SetFloat(AnimFloatName, 1); }
if (DoAnimBool && AnimOn)
{ SetBoolOff(); }
}
Expand All @@ -133,13 +133,13 @@ public void SFEXT_G_ReSupply()
if (NumAGM != FullAGMs)
{ SAVControl.SetProgramVariable("ReSupplied", (int)SAVControl.GetProgramVariable("ReSupplied") + 1); }
NumAGM = (int)Mathf.Min(NumAGM + Mathf.Max(Mathf.Floor(reloadspeed), 1), FullAGMs);
AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider);
if (AGMAnimator) { AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider); }
if (HUDText_AGM_ammo) { HUDText_AGM_ammo.text = NumAGM.ToString("F0"); }
}
public void SFEXT_G_Explode()
{
NumAGM = FullAGMs;
AGMAnimator.SetFloat(AnimFloatName, 1);
if (AGMAnimator) { AGMAnimator.SetFloat(AnimFloatName, 1); }
if (func_active)
{ DFUNC_Deselected(); }
if (DoAnimBool && AnimOn)
Expand All @@ -163,6 +163,8 @@ public void DFUNC_Deselected()
if (DoAnimBool && AnimOn)
{ SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(SetBoolOff)); }
if (OthersEnabled) { SendCustomNetworkEvent(VRC.Udon.Common.Interfaces.NetworkEventTarget.All, nameof(DisableForOthers)); }
AGMUnlockTimer = 0;
AGMUnlocking = 0;
}
public void EnableForOthers()
{
Expand Down Expand Up @@ -353,15 +355,18 @@ public void LaunchAGM()
{
if (NumAGM > 0) { NumAGM--; }
if (!InEditor) { IsOwner = localPlayer.IsOwner(gameObject); } else { IsOwner = true; }
AGMAnimator.SetTrigger(AnimFiredTriggerName);
if (AGM)
{
GameObject NewAGM = VRCInstantiate(AGM);
NewAGM.transform.SetPositionAndRotation(AGMLaunchPoint.position, AGMLaunchPoint.rotation);
NewAGM.SetActive(true);
NewAGM.GetComponent<Rigidbody>().velocity = (Vector3)SAVControl.GetProgramVariable("CurrentVel");
}
AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider);
if (AGMAnimator)
{
AGMAnimator.SetTrigger(AnimFiredTriggerName);
AGMAnimator.SetFloat(AnimFloatName, (float)NumAGM * FullAGMsDivider);
}
if (HUDText_AGM_ammo) { HUDText_AGM_ammo.text = NumAGM.ToString("F0"); }
}
private void FindSelf()
Expand Down Expand Up @@ -394,13 +399,13 @@ public void SetBoolOn()
{
boolToggleTime = Time.time;
AnimOn = true;
AGMAnimator.SetBool(AnimBoolName, AnimOn);
if (AGMAnimator) { AGMAnimator.SetBool(AnimBoolName, AnimOn); }
}
public void SetBoolOff()
{
boolToggleTime = Time.time;
AnimOn = false;
AGMAnimator.SetBool(AnimBoolName, AnimOn);
if (AGMAnimator) { AGMAnimator.SetBool(AnimBoolName, AnimOn); }
}
public void KeyboardInput()
{
Expand Down
5 changes: 1 addition & 4 deletions Scripts/DFUNC/DFUNC_Reverse.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ public void SFEXT_L_EntityStart()
StartABStrength = (float)SAVControl.GetProgramVariable("ThrottleStrengthAB");
ReversingThrottleStrength = StartThrottleStrength * ReversingThrottleMultiplier;
ReversingABStrength = StartABStrength * ReversingThrottleMultiplier;
if (Dial_funcon) { Dial_funcon.SetActive(false); }
}
public void DFUNC_Selected()
{
Expand All @@ -35,10 +36,6 @@ public void DFUNC_Deselected()
{
gameObject.SetActive(false);
}
public void SFEXT_O_PilotEnter()
{
if (Dial_funcon) { Dial_funcon.SetActive(Reversing); }
}
public void SFEXT_O_PilotExit()
{
if (Reversing)
Expand Down
12 changes: 9 additions & 3 deletions Scripts/Other/SaccFlight.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ public class SaccFlight : UdonSharpBehaviour
public float ThrustStrength = .33f;
[Tooltip("Strength of extra thrust applied when trying to thrust in direction going against movement")]
public float BackThrustStrength = .5f;
private float _thruststrength;
private float _backthruststrength;
private float controllertriggerR;
private float controllertriggerL;
private bool InVR = false;
Expand All @@ -20,11 +22,15 @@ private void Start()
if (localPlayer == null) { gameObject.SetActive(false); }//fixedupdate runs before this happens and causes a crash in the editor until vrc fix it
else if (localPlayer.IsUserInVR())
{ InVR = true; }
//to match 90fps with deltatime
_thruststrength = ThrustStrength * 90;
_backthruststrength = BackThrustStrength * 90;
}
private void FixedUpdate()
{
if (!localPlayer.IsPlayerGrounded())//only does anything if in the air.
{
float DeltaTime = Time.fixedDeltaTime;
float ForwardThrust = Mathf.Max(Input.GetAxisRaw("Oculus_CrossPlatform_SecondaryIndexTrigger"), Input.GetKey(KeyCode.F) ? 1 : 0);
float UpThrust = Mathf.Max(Input.GetAxisRaw("Oculus_CrossPlatform_PrimaryIndexTrigger"), Input.GetKey(KeyCode.Space) ? 1 : 0);

Expand All @@ -43,10 +49,10 @@ private void FixedUpdate()
NewForwardVec = newrot * (Vector3.forward);
}
//get backwards amount
float BackThrustAmount = -((Vector3.Dot(PlayerVel, NewForwardVec)) * BackThrustStrength);
NewForwardVec = NewForwardVec * ThrustStrength * ForwardThrust * Mathf.Max(1, (BackThrustAmount * ForwardThrust));
float BackThrustAmount = -((Vector3.Dot(PlayerVel, NewForwardVec)) * _backthruststrength * DeltaTime);
NewForwardVec = NewForwardVec * _thruststrength * ForwardThrust * DeltaTime * Mathf.Max(1, (BackThrustAmount * ForwardThrust));

Vector3 NewUpVec = ((Vector3.up * ThrustStrength) * UpThrust);
Vector3 NewUpVec = ((Vector3.up * _thruststrength) * UpThrust * DeltaTime);

localPlayer.SetVelocity(PlayerVel + NewForwardVec + NewUpVec);
}
Expand Down
Binary file added Textures/SFLogo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 2c8216d

Please sign in to comment.