Quickly added Enemy_4

This commit is contained in:
Trimutex 2024-03-14 11:56:10 -05:00
parent a58f4c9db0
commit 479a0fcfc2
8 changed files with 202 additions and 28 deletions

View File

@ -38,7 +38,7 @@ RenderSettings:
m_ReflectionIntensity: 1 m_ReflectionIntensity: 1
m_CustomReflection: {fileID: 0} m_CustomReflection: {fileID: 0}
m_Sun: {fileID: 705507994} m_Sun: {fileID: 705507994}
m_IndirectSpecularColor: {r: 0.18028378, g: 0.22571412, b: 0.30692285, a: 1} m_IndirectSpecularColor: {r: 0.18028328, g: 0.22571328, b: 0.3069218, a: 1}
m_UseRadianceAmbientProbe: 0 m_UseRadianceAmbientProbe: 0
--- !u!157 &3 --- !u!157 &3
LightmapSettings: LightmapSettings:
@ -475,6 +475,7 @@ MonoBehaviour:
- {fileID: 1716873588767813483, guid: ba65718b1eee9fde8b64fc1c56f7fcd7, type: 3} - {fileID: 1716873588767813483, guid: ba65718b1eee9fde8b64fc1c56f7fcd7, type: 3}
- {fileID: 1454311047477341964, guid: c033931eb931661a285a471741bae343, type: 3} - {fileID: 1454311047477341964, guid: c033931eb931661a285a471741bae343, type: 3}
- {fileID: 1454311047477341964, guid: c033931eb931661a285a471741bae343, type: 3} - {fileID: 1454311047477341964, guid: c033931eb931661a285a471741bae343, type: 3}
- {fileID: 5688048094632641677, guid: 68c912c6fd38ee6258ae1295410e82ea, type: 3}
enemySpawnPerSecond: 0.5 enemySpawnPerSecond: 0.5
enemyDefaultPadding: 1.5 enemyDefaultPadding: 1.5
--- !u!1 &998017458 --- !u!1 &998017458

View File

@ -183,7 +183,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3} m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
radius: -2.5 radius: 3
keepOnScreen: 0 keepOnScreen: 0
isOnScreen: 1 isOnScreen: 1
camWidth: 0 camWidth: 0

View File

@ -375,7 +375,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3} m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
m_Name: m_Name:
m_EditorClassIdentifier: m_EditorClassIdentifier:
radius: -2.5 radius: 2.5
keepOnScreen: 0 keepOnScreen: 0
isOnScreen: 1 isOnScreen: 1
camWidth: 0 camWidth: 0

View File

@ -10,6 +10,8 @@ GameObject:
m_Component: m_Component:
- component: {fileID: 5688048094632641678} - component: {fileID: 5688048094632641678}
- component: {fileID: 5688048094632641679} - component: {fileID: 5688048094632641679}
- component: {fileID: 6012299646585092094}
- component: {fileID: 6289777641844929688}
m_Layer: 9 m_Layer: 9
m_Name: Enemy_4 m_Name: Enemy_4
m_TagString: Enemy m_TagString: Enemy
@ -52,6 +54,67 @@ Rigidbody:
m_Interpolate: 0 m_Interpolate: 0
m_Constraints: 120 m_Constraints: 120
m_CollisionDetection: 0 m_CollisionDetection: 0
--- !u!114 &6012299646585092094
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5688048094632641677}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: a2b7c79b712fe5c9ca22495cdf2f32b7, type: 3}
m_Name:
m_EditorClassIdentifier:
radius: 3.5
keepOnScreen: 0
isOnScreen: 1
camWidth: 0
camHeight: 0
offRight: 0
offLeft: 0
offUp: 0
offDown: 0
--- !u!114 &6289777641844929688
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 5688048094632641677}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: 890512b9c88f600408f25130d273807b, type: 3}
m_Name:
m_EditorClassIdentifier:
speed: 10
fireRate: 0.3
health: 10
score: 100
parts:
- name: Cockpit
health: 10
protectedBy:
- Fuselage
go: {fileID: 0}
mat: {fileID: 0}
- name: Fuselage
health: 10
protectedBy:
- WingL
- WingR
go: {fileID: 0}
mat: {fileID: 0}
- name: WingL
health: 10
protectedBy: []
go: {fileID: 0}
mat: {fileID: 0}
- name: WingR
health: 10
protectedBy: []
go: {fileID: 0}
mat: {fileID: 0}
--- !u!1 &5688048095306501618 --- !u!1 &5688048095306501618
GameObject: GameObject:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
@ -63,7 +126,7 @@ GameObject:
- component: {fileID: 5688048095306501619} - component: {fileID: 5688048095306501619}
- component: {fileID: 5688048095306501622} - component: {fileID: 5688048095306501622}
- component: {fileID: 5688048095306501621} - component: {fileID: 5688048095306501621}
- component: {fileID: 5688048095306501620} - component: {fileID: 1336262608}
m_Layer: 9 m_Layer: 9
m_Name: WingR m_Name: WingR
m_TagString: Untagged m_TagString: Untagged
@ -136,8 +199,8 @@ MeshRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0} m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &5688048095306501620 --- !u!136 &1336262608
SphereCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -146,8 +209,9 @@ SphereCollider:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5 m_Radius: 0.5
m_Height: 1
m_Direction: 0
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &5688048095477329001 --- !u!1 &5688048095477329001
GameObject: GameObject:
@ -160,7 +224,7 @@ GameObject:
- component: {fileID: 5688048095477329002} - component: {fileID: 5688048095477329002}
- component: {fileID: 5688048095477329005} - component: {fileID: 5688048095477329005}
- component: {fileID: 5688048095477329004} - component: {fileID: 5688048095477329004}
- component: {fileID: 5688048095477329003} - component: {fileID: 1336262606}
m_Layer: 9 m_Layer: 9
m_Name: WingL m_Name: WingL
m_TagString: Untagged m_TagString: Untagged
@ -233,8 +297,8 @@ MeshRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0} m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &5688048095477329003 --- !u!136 &1336262606
SphereCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -243,8 +307,9 @@ SphereCollider:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5 m_Radius: 0.5
m_Height: 1
m_Direction: 0
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &5688048095502189620 --- !u!1 &5688048095502189620
GameObject: GameObject:
@ -257,7 +322,7 @@ GameObject:
- component: {fileID: 5688048095502189621} - component: {fileID: 5688048095502189621}
- component: {fileID: 5688048095502189624} - component: {fileID: 5688048095502189624}
- component: {fileID: 5688048095502189623} - component: {fileID: 5688048095502189623}
- component: {fileID: 5688048095502189622} - component: {fileID: 1336262604}
m_Layer: 9 m_Layer: 9
m_Name: Fuselage m_Name: Fuselage
m_TagString: Untagged m_TagString: Untagged
@ -330,8 +395,8 @@ MeshRenderer:
m_SortingLayer: 0 m_SortingLayer: 0
m_SortingOrder: 0 m_SortingOrder: 0
m_AdditionalVertexStreams: {fileID: 0} m_AdditionalVertexStreams: {fileID: 0}
--- !u!135 &5688048095502189622 --- !u!136 &1336262604
SphereCollider: CapsuleCollider:
m_ObjectHideFlags: 0 m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0} m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0} m_PrefabInstance: {fileID: 0}
@ -340,8 +405,9 @@ SphereCollider:
m_Material: {fileID: 0} m_Material: {fileID: 0}
m_IsTrigger: 0 m_IsTrigger: 0
m_Enabled: 1 m_Enabled: 1
serializedVersion: 2
m_Radius: 0.5 m_Radius: 0.5
m_Height: 1
m_Direction: 1
m_Center: {x: 0, y: 0, z: 0} m_Center: {x: 0, y: 0, z: 0}
--- !u!1 &5688048095870530698 --- !u!1 &5688048095870530698
GameObject: GameObject:

View File

@ -2,17 +2,66 @@ using System.Collections;
using System.Collections.Generic; using System.Collections.Generic;
using UnityEngine; using UnityEngine;
/// <summary>
/// Enemy_4 will start offscreen and then pick a random point on screen to
/// move to. Once it has arrived, it will pick another random point and
/// continue until the player has shot it down.
/// </summary>
[System.Serializable]
public class Part {
// These three fields need to be defined in the Inspector pane
public string name;
public float health;
public string[] protectedBy;
[HideInInspector]
public GameObject go;
[HideInInspector]
public Material mat;
}
public class Enemy_4 : Enemy public class Enemy_4 : Enemy
{ {
// Start is called before the first frame update [Header("Set in Inspector: Enemy_4")]
public Part[] parts;
private Vector3 p0, p1; // The two points to interpolate
private float timeStart; // Birth time for this Enemy_4
private float duration = 4; // Duration of movement
void Start() void Start()
{ {
// There is already an initial position chosen by Main.SpawnEnemy()
// so add it to points as the initial p0 & p1
p0 = p1 = pos;
InitMovement();
Transform t;
foreach(Part prt in parts) {
t = transform.Find(prt.name);
if (t != null) {
prt.go = t.gameObject;
prt.mat = prt.go.GetComponent<Renderer>().material;
}
}
} }
// Update is called once per frame void InitMovement() {
void Update() p0 = p1; // Set p0 to the old p1
{ // Assign a new on-screen location to p1
float widMinRad = bndCheck.camWidth - bndCheck.radius;
float hgtMinRad = bndCheck.camHeight - bndCheck.radius;
p1.x = Random.Range(-widMinRad, widMinRad);
p1.y = Random.Range(-hgtMinRad, hgtMinRad);
// Reset the time
timeStart = Time.time;
}
public override void Move() {
// This completely overrides Enemy.Move() with a linear interpolation
float u = (Time.time - timeStart) / duration;
if (u >= 1) {
InitMovement();
u = 0;
}
u = 1 - Mathf.Pow(1 - u, 2); // Apply East Out easing to u
pos = (1 - u) * p0 + u*p1; // Simple linear interpolation
} }
} }

View File

@ -0,0 +1,34 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
/// <summary>
/// This is an enum of the various possible weapon types.
/// It also includes a "shield" type to allow a shield power-up.
/// Items marked [NI] below are Not Implemented in the IGDPD book.
/// </summary>
public enum WeaponType {
none, // The default / no weapon
blaster, // A simple blaster
spread, // Two shots simultaneously
phaser, // [NI] Shots that move in waves
missile, // [NI] Homing missiles
laser, // [NI]Damage over time
shield // Raise shieldLevel
}
public class Weapon : MonoBehaviour
{
// Start is called before the first frame update
void Start()
{
}
// Update is called once per frame
void Update()
{
}
}

View File

@ -0,0 +1,11 @@
fileFormatVersion: 2
guid: 8a45dacce959bdd1c943cd342de8d377
MonoImporter:
externalObjects: {}
serializedVersion: 2
defaultReferences: []
executionOrder: 0
icon: {instanceID: 0}
userData:
assetBundleName:
assetBundleVariant:

View File

@ -18,7 +18,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 1 skinWeights: 1
textureQuality: 1 textureQuality: 1
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@ -27,6 +27,7 @@ QualitySettings:
realtimeReflectionProbes: 0 realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0 billboardsFaceCameraPosition: 0
vSyncCount: 0 vSyncCount: 0
realtimeGICPUUsage: 25
lodBias: 0.3 lodBias: 0.3
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -40,6 +41,7 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
name: Low name: Low
@ -53,7 +55,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 0 anisotropicTextures: 0
antiAliasing: 0 antiAliasing: 0
@ -62,6 +64,7 @@ QualitySettings:
realtimeReflectionProbes: 0 realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0 billboardsFaceCameraPosition: 0
vSyncCount: 0 vSyncCount: 0
realtimeGICPUUsage: 25
lodBias: 0.4 lodBias: 0.4
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -75,6 +78,7 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
name: Medium name: Medium
@ -88,7 +92,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 0 shadowmaskMode: 0
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 1 anisotropicTextures: 1
antiAliasing: 0 antiAliasing: 0
@ -97,6 +101,7 @@ QualitySettings:
realtimeReflectionProbes: 0 realtimeReflectionProbes: 0
billboardsFaceCameraPosition: 0 billboardsFaceCameraPosition: 0
vSyncCount: 1 vSyncCount: 1
realtimeGICPUUsage: 25
lodBias: 0.7 lodBias: 0.7
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -110,6 +115,7 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
name: High name: High
@ -123,7 +129,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 2 skinWeights: 2
textureQuality: 0 textureQuality: 0
anisotropicTextures: 1 anisotropicTextures: 1
antiAliasing: 0 antiAliasing: 0
@ -132,6 +138,7 @@ QualitySettings:
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1 billboardsFaceCameraPosition: 1
vSyncCount: 1 vSyncCount: 1
realtimeGICPUUsage: 50
lodBias: 1 lodBias: 1
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -145,6 +152,7 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
name: Very High name: Very High
@ -158,7 +166,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 2 antiAliasing: 2
@ -167,6 +175,7 @@ QualitySettings:
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1 billboardsFaceCameraPosition: 1
vSyncCount: 1 vSyncCount: 1
realtimeGICPUUsage: 50
lodBias: 1.5 lodBias: 1.5
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -180,6 +189,7 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
- serializedVersion: 2 - serializedVersion: 2
name: Ultra name: Ultra
@ -193,7 +203,7 @@ QualitySettings:
shadowCascade2Split: 0.33333334 shadowCascade2Split: 0.33333334
shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667} shadowCascade4Split: {x: 0.06666667, y: 0.2, z: 0.46666667}
shadowmaskMode: 1 shadowmaskMode: 1
blendWeights: 4 skinWeights: 4
textureQuality: 0 textureQuality: 0
anisotropicTextures: 2 anisotropicTextures: 2
antiAliasing: 2 antiAliasing: 2
@ -202,6 +212,7 @@ QualitySettings:
realtimeReflectionProbes: 1 realtimeReflectionProbes: 1
billboardsFaceCameraPosition: 1 billboardsFaceCameraPosition: 1
vSyncCount: 1 vSyncCount: 1
realtimeGICPUUsage: 100
lodBias: 2 lodBias: 2
maximumLODLevel: 0 maximumLODLevel: 0
streamingMipmapsActive: 0 streamingMipmapsActive: 0
@ -215,16 +226,18 @@ QualitySettings:
asyncUploadBufferSize: 16 asyncUploadBufferSize: 16
asyncUploadPersistentBuffer: 1 asyncUploadPersistentBuffer: 1
resolutionScalingFixedDPIFactor: 1 resolutionScalingFixedDPIFactor: 1
customRenderPipeline: {fileID: 0}
excludedTargetPlatforms: [] excludedTargetPlatforms: []
m_PerPlatformDefaultQuality: m_PerPlatformDefaultQuality:
Android: 2 Android: 2
Lumin: 5
GameCoreScarlett: 5 GameCoreScarlett: 5
GameCoreXboxOne: 5 GameCoreXboxOne: 5
Lumin: 5
Nintendo 3DS: 5 Nintendo 3DS: 5
Nintendo Switch: 5 Nintendo Switch: 5
PS4: 5 PS4: 5
PS5: 5 PS5: 5
Server: 0
Stadia: 5 Stadia: 5
Standalone: 5 Standalone: 5
WebGL: 3 WebGL: 3