wand power value affects spells

This commit is contained in:
joonasp 2022-04-25 12:55:41 +03:00
parent 06045c07fb
commit 270acfd18d
12 changed files with 754 additions and 746 deletions

View File

@ -13,6 +13,8 @@ public class ActionGestureInteraction : MonoBehaviour
public float projectileSpeed = 30;
private bool holdingWand;
private float wandPower;
private string wandElement;
public AudioSource noEssenceAudio;
@ -28,6 +30,7 @@ public class ActionGestureInteraction : MonoBehaviour
if (player.GetComponent<PlayerInfo>().GetRightHand() != null)
{
if (player.GetComponent<PlayerInfo>().GetRightHand().name.StartsWith("wand")) holdingWand = true;
wandPower = player.GetComponent<PlayerInfo>().GetRightHand().GetComponent<WandData>().power;
}
else holdingWand = false;
@ -55,6 +58,7 @@ public class ActionGestureInteraction : MonoBehaviour
Vector3 spawnPoint = transform.position + playerCamera.transform.forward;
spawnPoint = new Vector3(spawnPoint.x, spawnPoint.y + 1, spawnPoint.z);
GameObject shield = Instantiate(objects[1], spawnPoint, Quaternion.Euler(-90, playerCamera.transform.eulerAngles.y - 180, 180));
shield.GetComponent<ShieldController>().health = 3 * wandPower;
}
else
{
@ -182,6 +186,7 @@ public class ActionGestureInteraction : MonoBehaviour
{
Debug.LogWarning("INSTANTIATE BOLT");
var projectileObj = Instantiate(item, rightHandTransform.position, playerCamera.transform.rotation) as GameObject;
projectileObj.GetComponent<Projectile>().damage = 1 * wandPower;
projectileObj.GetComponent<Rigidbody>().velocity = (playerCamera.transform.forward).normalized * projectileSpeed;
}
}

View File

@ -7,6 +7,8 @@ public class Projectile : MonoBehaviour
private bool collided;
Vector3 oldEulerAngles;
public float damage;
private void Start()
{
// Will always be destroyed after 10 seconds.
@ -29,7 +31,7 @@ public class Projectile : MonoBehaviour
if (collision.gameObject.tag != "IceBolt" && collision.gameObject.tag != "Player" && !collided)
{
collided = true;
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK
if (collision.gameObject.name == "Dummy") Destroy(collision.gameObject); //REPLACE WITH ENEMY TAG CHECK AND DAMAGE CHECKING
Destroy(gameObject);
}

View File

@ -1,3 +1,4 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
@ -53,7 +54,7 @@ public class CraftingTable : MonoBehaviour
if (item1.name.StartsWith("wand"))
{
WandData data = item1.GetComponent<WandData>();
data.SetDamage(data.damage + 0.5f);
data.SetPower(data.power + 0.5f);
item1.transform.position = output.position;
Destroy(item2.gameObject);
item2 = null;
@ -61,7 +62,7 @@ public class CraftingTable : MonoBehaviour
else
{
WandData data = item2.GetComponent<WandData>();
data.SetDamage(data.damage + 0.5f);
data.SetPower(data.power + 0.5f);
item2.transform.position = output.position;
Destroy(item1.gameObject);
item1 = null;

View File

@ -4,13 +4,13 @@ using UnityEngine;
public class WandData : MonoBehaviour
{
public float damage = 1f;
public float power = 1f;
//public string element = "water";
public void SetDamage(float dam)
public void SetPower(float pow)
{
damage = dam;
power = dam;
}
}

File diff suppressed because one or more lines are too long

View File

@ -90,19 +90,19 @@ Material:
- _HorizonCloudSize: 4.91
- _HorizonCloudStartPosition: -0.1
- _HorizonCloudStep: 25
- _HorizonExponent: 3.413162
- _HorizonExponent: 3.4817753
- _HorizonStep: 500
- _HorizonThickness: 1
- _MoonGlow: 0
- _MoonLightIntensity: 0.00016832352
- _MoonLightIntensity: 0.000000035966536
- _MoonSize: 0
- _MoonSoftEdge: 0
- _OverheadCloudAltitude: 1000
- _OverheadCloudAnimationSpeed: 50
- _OverheadCloudFlowDirectionX: 1
- _OverheadCloudFlowDirectionZ: 1
- _OverheadCloudRemapMax: 1.0825808
- _OverheadCloudRemapMin: 0.11877813
- _OverheadCloudRemapMax: 1.111836
- _OverheadCloudRemapMin: 0.14032736
- _OverheadCloudSize: 10
- _OverheadCloudStep: 2
- _StarsDensity0: 0.4
@ -112,7 +112,7 @@ Material:
- _StarsGlow0: 0.01
- _StarsGlow1: 0.01
- _StarsGlow2: 0.01
- _StarsOpacity: 0.00025045872
- _StarsOpacity: 0
- _StarsSize0: 0.42
- _StarsSize1: 0.53
- _StarsSize2: 0.46
@ -121,25 +121,25 @@ Material:
- _StarsTwinkle1: 6
- _StarsTwinkle2: 2
- _SunGlow: 0.45
- _SunLightIntensity: 0.23317944
- _SunLightIntensity: 0.2677219
- _SunSize: 0.1
- _SunSoftEdge: 0.5
m_Colors:
- _DetailOverlayTintColor: {r: 0, g: 0, b: 0, a: 0}
- _FogColor: {r: 0, g: 0, b: 0, a: 0}
- _GroundColor: {r: 0.41117027, g: 0.39097697, b: 0.43009043, a: 1}
- _GroundColor: {r: 0.4145582, g: 0.39513505, b: 0.43275675, a: 1}
- _HorizonCloudColor: {r: 1, g: 1, b: 1, a: 1}
- _HorizonColor: {r: 0.90510267, g: 0.8537416, b: 0.7445281, a: 1}
- _HorizonColor: {r: 0.9036219, g: 0.85824037, b: 0.75315446, a: 1}
- _MoonColor: {r: 1, g: 1, b: 1, a: 0}
- _MoonDirection: {r: 1, g: 1, b: 1, a: 0}
- _MoonLightColor: {r: 0, g: 0, b: 0, a: 0}
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.96559054}
- _SkyColor: {r: 0.20731923, g: 0.35935244, b: 0.5941384, a: 1}
- _OverheadCloudColor: {r: 1, g: 1, b: 1, a: 0.9704287}
- _SkyColor: {r: 0.21358334, g: 0.375544, b: 0.61277795, a: 1}
- _StarsColor0: {r: 0.96470594, g: 0.9450981, b: 0.76470596, a: 1}
- _StarsColor1: {r: 1, g: 0.5294118, b: 0.93725497, a: 1}
- _StarsColor2: {r: 0, g: 0.92549026, b: 1, a: 1}
- _SunColor: {r: 0.97403157, g: 0.93118227, b: 0.8604809, a: 1}
- _SunDirection: {r: 0, g: -0.2739166, b: 0.9617534, a: 0}
- _SunColor: {r: 0.9733385, g: 0.92934555, b: 0.8567572, a: 1}
- _SunDirection: {r: 0, g: -0.32100654, b: 0.947077, a: 0}
- _SunLightColor: {r: 1, g: 0.9929226, b: 0.9009434, a: 1}
m_BuildTextureStacks: []
--- !u!114 &11400000

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -27,17 +27,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: -3749757436880339867, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: 267836043492244672, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: -7662155014128338692, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: -8680801843166753595, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: -2059419680052025504, guid: b6bbea2e1167a7346822545139402874,
m_Texture: {fileID: -1724098632641955843, guid: b6bbea2e1167a7346822545139402874,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

View File

@ -40,17 +40,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: -908707757832971230, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: 4890550564176084081, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: 7918359287852339356, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: 6115247967752550248, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: 5482261568377072082, guid: 726ce83d589353742be6b48ff467fc48,
m_Texture: {fileID: 2682105773940954556, guid: 726ce83d589353742be6b48ff467fc48,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}

View File

@ -40,17 +40,17 @@ Material:
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorBlend:
m_Texture: {fileID: -693261927230776517, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: 6722565258155319923, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByHeight:
m_Texture: {fileID: 4185078901495159847, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: 2342339564386810282, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}
- _ColorByNormal:
m_Texture: {fileID: 2680276908967889646, guid: 7f589c682d367b442b8cf75918f5aa55,
m_Texture: {fileID: 2466957666415323811, guid: 7f589c682d367b442b8cf75918f5aa55,
type: 2}
m_Scale: {x: 1, y: 1}
m_Offset: {x: 0, y: 0}