Browse Source

Falling works + fixed cannon prefab

master
Joshua Reason 4 years ago
parent
commit
506cfb8f2c
9 changed files with 280 additions and 29 deletions
  1. +1
    -1
      Assets/Prefabs/Traps/ShootingCannon + Block.prefab
  2. +214
    -5
      Assets/Prefabs/Traps/ShootingCannon.prefab
  3. +22
    -0
      Assets/Resources/Cube_Air.prefab
  4. +3
    -3
      Assets/Scripts/LevelBlocks/Air.cs
  5. +21
    -12
      Assets/Scripts/LevelBlocks/Block.cs
  6. +8
    -6
      Assets/Scripts/Logic/Blocks/Jump.cs
  7. +3
    -0
      Assets/Scripts/Logic/Blocks/Move.cs
  8. +7
    -1
      Assets/Scripts/blockSpawn.cs
  9. +1
    -1
      ProjectSettings/EditorBuildSettings.asset

+ 1
- 1
Assets/Prefabs/Traps/ShootingCannon + Block.prefab View File

@ -360,7 +360,7 @@ MonoBehaviour:
type: 3}
spawnLocation: {fileID: 6183695074135418386}
counter: {fileID: 7559508468311915784}
counter2: {fileID: 0}
counter2: {fileID: 6305338656115376912}
--- !u!1 &6180422965807075217
GameObject:
m_ObjectHideFlags: 0

+ 214
- 5
Assets/Prefabs/Traps/ShootingCannon.prefab View File

@ -207,6 +207,213 @@ MonoBehaviour:
- {fileID: 0}
- {fileID: 0}
m_maskType: 0
--- !u!1 &336793339243699800
GameObject:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
serializedVersion: 6
m_Component:
- component: {fileID: 6635152555428778235}
- component: {fileID: 6388790028885912509}
- component: {fileID: 7116532525626497099}
- component: {fileID: 1302401007546834860}
- component: {fileID: 1967023221621108560}
m_Layer: 0
m_Name: Countdown Timer (1)
m_TagString: Untagged
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
--- !u!224 &6635152555428778235
RectTransform:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 336793339243699800}
m_LocalRotation: {x: 0, y: 0.7071068, z: 0, w: 0.7071068}
m_LocalPosition: {x: 0, y: 0, z: 0.134}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children: []
m_Father: {fileID: 4407065910963968002}
m_RootOrder: 3
m_LocalEulerAnglesHint: {x: 0, y: 90, z: 0}
m_AnchorMin: {x: 0.5, y: 0.5}
m_AnchorMax: {x: 0.5, y: 0.5}
m_AnchoredPosition: {x: -0.264, y: 1.321}
m_SizeDelta: {x: 0.5, y: 0.5}
m_Pivot: {x: 0.5, y: 0.5}
--- !u!23 &6388790028885912509
MeshRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 336793339243699800}
m_Enabled: 1
m_CastShadows: 0
m_ReceiveShadows: 0
m_DynamicOccludee: 1
m_MotionVectors: 1
m_LightProbeUsage: 1
m_ReflectionProbeUsage: 1
m_RenderingLayerMask: 1
m_RendererPriority: 0
m_Materials:
- {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_StaticBatchInfo:
firstSubMesh: 0
subMeshCount: 0
m_StaticBatchRoot: {fileID: 0}
m_ProbeAnchor: {fileID: 0}
m_LightProbeVolumeOverride: {fileID: 0}
m_ScaleInLightmap: 1
m_PreserveUVs: 0
m_IgnoreNormalsForChartDetection: 0
m_ImportantGI: 0
m_StitchLightmapSeams: 0
m_SelectedEditorRenderState: 3
m_MinimumChartSize: 4
m_AutoUVMaxDistance: 0.5
m_AutoUVMaxAngle: 89
m_LightmapParameters: {fileID: 0}
m_SortingLayerID: 0
m_SortingLayer: 0
m_SortingOrder: 0
--- !u!33 &7116532525626497099
MeshFilter:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 336793339243699800}
m_Mesh: {fileID: 0}
--- !u!222 &1302401007546834860
CanvasRenderer:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 336793339243699800}
m_CullTransparentMesh: 0
--- !u!114 &1967023221621108560
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 336793339243699800}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 9541d86e2fd84c1d9990edf0852d74ab, type: 3}
m_Name:
m_EditorClassIdentifier:
m_Material: {fileID: 0}
m_Color: {r: 1, g: 1, b: 1, a: 1}
m_RaycastTarget: 1
m_OnCullStateChanged:
m_PersistentCalls:
m_Calls: []
m_TypeName: UnityEngine.UI.MaskableGraphic+CullStateChangedEvent, UnityEngine.UI,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null
m_text: 5
m_isRightToLeft: 0
m_fontAsset: {fileID: 11400000, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_sharedMaterial: {fileID: 2180264, guid: 8f586378b4e144a9851e7b34d9b748ee, type: 2}
m_fontSharedMaterials: []
m_fontMaterial: {fileID: 0}
m_fontMaterials: []
m_fontColor32:
serializedVersion: 2
rgba: 4294967295
m_fontColor: {r: 1, g: 1, b: 1, a: 1}
m_enableVertexGradient: 0
m_colorMode: 3
m_fontColorGradient:
topLeft: {r: 1, g: 1, b: 1, a: 1}
topRight: {r: 1, g: 1, b: 1, a: 1}
bottomLeft: {r: 1, g: 1, b: 1, a: 1}
bottomRight: {r: 1, g: 1, b: 1, a: 1}
m_fontColorGradientPreset: {fileID: 0}
m_spriteAsset: {fileID: 0}
m_tintAllSprites: 0
m_overrideHtmlColors: 0
m_faceColor:
serializedVersion: 2
rgba: 4294967295
m_outlineColor:
serializedVersion: 2
rgba: 4278190080
m_fontSize: 3
m_fontSizeBase: 3
m_fontWeight: 400
m_enableAutoSizing: 0
m_fontSizeMin: 18
m_fontSizeMax: 72
m_fontStyle: 0
m_textAlignment: 514
m_isAlignmentEnumConverted: 1
m_characterSpacing: 0
m_wordSpacing: 0
m_lineSpacing: 0
m_lineSpacingMax: 0
m_paragraphSpacing: 0
m_charWidthMaxAdj: 0
m_enableWordWrapping: 1
m_wordWrappingRatios: 0.4
m_overflowMode: 0
m_firstOverflowCharacterIndex: -1
m_linkedTextComponent: {fileID: 0}
m_isLinkedTextComponent: 0
m_isTextTruncated: 0
m_enableKerning: 1
m_enableExtraPadding: 0
checkPaddingRequired: 0
m_isRichText: 1
m_parseCtrlCharacters: 1
m_isOrthographic: 0
m_isCullingEnabled: 0
m_ignoreRectMaskCulling: 0
m_ignoreCulling: 1
m_horizontalMapping: 0
m_verticalMapping: 0
m_uvLineOffset: 0
m_geometrySortingOrder: 0
m_firstVisibleCharacter: 0
m_useMaxVisibleDescender: 1
m_pageToDisplay: 1
m_margin: {x: 0, y: 0, z: 0, w: 0}
m_textInfo:
textComponent: {fileID: 1967023221621108560}
characterCount: 1
spriteCount: 0
spaceCount: 0
wordCount: 1
linkCount: 0
lineCount: 1
pageCount: 1
materialCount: 1
m_havePropertiesChanged: 0
m_isUsingLegacyAnimationComponent: 0
m_isVolumetricText: 0
m_spriteAnimator: {fileID: 0}
m_isInputParsingRequired: 0
m_inputSource: 0
m_hasFontAssetChanged: 0
m_renderer: {fileID: 6388790028885912509}
m_subTextObjects:
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
- {fileID: 0}
m_maskType: 0
--- !u!1 &4407065910963968001
GameObject:
m_ObjectHideFlags: 0
@ -238,6 +445,7 @@ Transform:
- {fileID: 4411312180479633393}
- {fileID: 4411389509623840118}
- {fileID: 1907555562}
- {fileID: 6635152555428778235}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -259,6 +467,7 @@ MonoBehaviour:
isPit: 0
isCrystals: 0
isRock: 0
isCollectableSpawnable: 0
isSpawnable: 0
SpawnDirection: 2
shootingRight: 1
@ -266,7 +475,7 @@ MonoBehaviour:
type: 3}
spawnLocation: {fileID: 4411312180479633393}
counter: {fileID: 1907555563}
countdowntimer: 3
counter2: {fileID: 1967023221621108560}
--- !u!65 &7713460145294617833
BoxCollider:
m_ObjectHideFlags: 0
@ -350,10 +559,6 @@ PrefabInstance:
m_Modification:
m_TransformParent: {fileID: 4407065910963968002}
m_Modifications:
- target: {fileID: 1229707520659320, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3}
propertyPath: m_Name
value: Cube_BalkHalf
objectReference: {fileID: 0}
- target: {fileID: 4831352554563246, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3}
propertyPath: m_LocalPosition.x
value: 0
@ -410,6 +615,10 @@ PrefabInstance:
propertyPath: m_LocalScale.z
value: 0.5
objectReference: {fileID: 0}
- target: {fileID: 1229707520659320, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3}
propertyPath: m_Name
value: Cube_BalkHalf
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: 601c1b79e12ee6f428da0cdfc7412e9e, type: 3}
--- !u!1 &4408273554855513639 stripped

+ 22
- 0
Assets/Resources/Cube_Air.prefab View File

@ -10,6 +10,7 @@ GameObject:
m_Component:
- component: {fileID: 47964057}
- component: {fileID: 6650162365135615188}
- component: {fileID: 5150695261866420698}
m_Layer: 0
m_Name: Cube_Air
m_TagString: Untagged
@ -44,3 +45,24 @@ BoxCollider:
serializedVersion: 2
m_Size: {x: 1, y: 1, z: 1}
m_Center: {x: 0, y: 0, z: 0}
--- !u!114 &5150695261866420698
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 1999421548732318256}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 47878f5822e300d4d8f65d09c87f7a81, type: 3}
m_Name:
m_EditorClassIdentifier:
VisualOffset: {x: 0, y: 0.5, z: 0}
is_Walkable: 1
isWater: 0
isPit: 0
isCrystals: 0
isRock: 0
isCollectableSpawnable: 0
isSpawnable: 0
SpawnDirection: 2

+ 3
- 3
Assets/Scripts/LevelBlocks/Air.cs View File

@ -16,10 +16,10 @@ public class Air : ActiveBlock
player.respawnNeeded = true;
StartCoroutine(player.AnimateToPosition(transform.position + Vector3.down * 10,Character.Animation.Hit, 1));
StartCoroutine(LerpScale(player.transform, Vector3.zero, 1));
yield return new WaitForSeconds(1);
yield return StartCoroutine(LerpScale(player.transform, Vector3.zero, 1));
player.gameObject.SetActive(false);
//player.gameObject.SetActive(false);
Debug.Log("Set player scale to one");
player.transform.localScale = Vector3.one;
isFinished = true;

+ 21
- 12
Assets/Scripts/LevelBlocks/Block.cs View File

@ -143,17 +143,19 @@ public class Block : MonoBehaviour
return this;
//If block at Position is walkable set it to moveTo
if (Block.isBlockAtPosition(newPosition, 1, ignoreMask, out hit) && hit.isWalkable(ignoreMask))
{
return hit;
}
//else if block down one is walkable
else if (Block.isBlockAtPosition(newPosition + Vector3.down, 1, ignoreMask, out hit) && hit.isWalkable(ignoreMask))
{
return hit;
}
return this;
return Block.GetOrCreateBlockAtPosition(newPosition, 1, ignoreMask);
////If block at Position is walkable set it to moveTo
//if (Block.isBlockAtPosition(newPosition, 1, ignoreMask, out hit) && hit.isWalkable(ignoreMask))
//{
// return hit;
//}
////else if block down one is walkable
//else if (Block.isBlockAtPosition(newPosition + Vector3.down, 1, ignoreMask, out hit) && hit.isWalkable(ignoreMask))
//{
// return hit;
//}
//return this;
}
#endregion Protected Functions
@ -269,7 +271,14 @@ public class Block : MonoBehaviour
if (isBlockAtPosition(position, Scale, layerMask, out retVal))
return retVal;
GameObject newBlock = Resources.Load<GameObject>("Cube_Air");
GameObject airBlock = Resources.Load<GameObject>("Cube_Air");
Debug.Log(airBlock, airBlock);
GameObject newBlock = Instantiate(airBlock);
newBlock.name = "AIR_BLOCK";
Debug.Log(newBlock, newBlock);
newBlock.transform.position = position;
return newBlock.GetComponent<Air>();
}

+ 8
- 6
Assets/Scripts/Logic/Blocks/Jump.cs View File

@ -83,12 +83,14 @@ public class Jump : LogicBlock
break;
//If block at Position is walkable set it to last known position
if (Block.isBlockAtPosition(position, 1, layerMask, out hit) && hit.isWalkable(layerMask))
retVal = hit;
//else if block down one is walkable
else if (Block.isBlockAtPosition(position + Vector3.down, 1, layerMask, out hit) && hit.isWalkable(layerMask))
retVal = hit;
retVal = Block.GetOrCreateBlockAtPosition(position, 1, layerMask);
////If block at Position is walkable set it to last known position
//if (Block.isBlockAtPosition(position, 1, layerMask, out hit) && hit.isWalkable(layerMask))
// retVal = hit;
////else if block down one is walkable
//else if (Block.isBlockAtPosition(position + Vector3.down, 1, layerMask, out hit) && hit.isWalkable(layerMask))
// retVal = hit;
}

+ 3
- 0
Assets/Scripts/Logic/Blocks/Move.cs View File

@ -48,6 +48,9 @@ public class Move : LogicBlock
Block hit; //output of block detection
Block retVal = startBlock; //Block we'll move to
return Block.GetOrCreateBlockAtPosition(wantedPosition, 1, layerMask);
//If block at Position is walkable set it to moveTo
if (Block.isBlockAtPosition(wantedPosition, 1, layerMask, out hit) && hit.isWalkable(layerMask))
{

+ 7
- 1
Assets/Scripts/blockSpawn.cs View File

@ -62,9 +62,12 @@ public class blockSpawn : MonoBehaviour
//pick a random value from those available, checks the location
//then removes it to remove the possibility of duplicates
Debug.Log("count after add " + possibleSpawnLocations.Count);
int triesCount = 0;
if(possibleSpawnLocations.Count > 0)
{
while (spawnNumber > 0)
while (spawnNumber > 0 && triesCount < 25)
{
if(possibleSpawnLocations.Count > 0){
int choice = Random.Range(0, possibleSpawnLocations.Count - 1);
@ -74,8 +77,10 @@ public class blockSpawn : MonoBehaviour
if (spawned == true)
{
possibleSpawnLocations.RemoveAt(choice);
triesCount = 0;
spawnNumber--;
}else{
triesCount++;
continue;
}
}
@ -86,6 +91,7 @@ public class blockSpawn : MonoBehaviour
}
Debug.Log("spawnNumber " + spawnNumber);
}
Debug.Log("SpawnTries: " + triesCount);
}
escape:
spawnNumber = 2;

+ 1
- 1
ProjectSettings/EditorBuildSettings.asset View File

@ -1,3 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:7be799905646e6d7aaab37702ab8e14db03f14e8814c42bb9471fdcb8028125e
oid sha256:81dc2bb76c1a5b7639713c40b44bce40b5757f89e1fe33e7033950ea47e88071
size 1282

Loading…
Cancel
Save