add some extra assets FX and SFX
This commit is contained in:
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/Grappling
|
||||
Hook System/grapplingHookEffect.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/Grappling
|
||||
Hook System/grapplingHookSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/Grappling
|
||||
Hook System/grapplingHookTarget.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/Grappling
|
||||
Hook System/grapplingHookTargetsSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,8 +13,9 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/Grappling
|
||||
Hook System/objectToAttractWithGrapplingHook.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -54,10 +54,12 @@ public class customAbilitySystem : abilityInfo
|
||||
public bool useEventOnDeactivateAbility;
|
||||
public UnityEvent eventOnDeactivateAbility;
|
||||
|
||||
|
||||
float lastTimePressDownUsed;
|
||||
|
||||
bool eventTriggeredOnPressHold;
|
||||
|
||||
|
||||
public override void updateAbilityState ()
|
||||
{
|
||||
if (useEventOnUpdateAbilityState) {
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/customAbilitySystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/drainStatSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -11,7 +11,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/laserPlayer.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/laserVisionSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/manualDetonationMineObject.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/manualDetonationMineSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/playerGravitySystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -4,288 +4,288 @@ using UnityEngine;
|
||||
|
||||
public class playerShieldSystem : abilityInfo
|
||||
{
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
[Header ("Custom Settings")]
|
||||
[Space]
|
||||
|
||||
public bool shieldEnabled;
|
||||
public bool shieldEnabled;
|
||||
|
||||
public bool shieldActive;
|
||||
public bool shieldActive;
|
||||
|
||||
public bool laserActive;
|
||||
public bool laserActive;
|
||||
|
||||
public bool laserAbilityEnabled = true;
|
||||
public bool laserAbilityEnabled = true;
|
||||
|
||||
public LayerMask layerToDamage;
|
||||
public LayerMask layerToDamage;
|
||||
|
||||
public bool returnProjectilesDetectedEnabled = true;
|
||||
public bool returnProjectilesDetectedEnabled = true;
|
||||
|
||||
public bool destroProjectilesStoredIfShieldDisabled;
|
||||
public bool destroProjectilesStoredIfShieldDisabled;
|
||||
|
||||
[Space]
|
||||
[Header ("Component Elements")]
|
||||
[Space]
|
||||
[Space]
|
||||
[Header ("Component Elements")]
|
||||
[Space]
|
||||
|
||||
public GameObject shield;
|
||||
public GameObject shield;
|
||||
|
||||
public armorSurfaceSystem armorSurfaceManager;
|
||||
public armorSurfaceSystem armorSurfaceManager;
|
||||
|
||||
public GameObject playerLaserGameObject;
|
||||
public GameObject playerLaserGameObject;
|
||||
|
||||
public laserPlayer laserPlayerManager;
|
||||
public laserPlayer laserPlayerManager;
|
||||
|
||||
public otherPowers mainOtherPowers;
|
||||
public otherPowers mainOtherPowers;
|
||||
|
||||
public Transform pivotCameraTransform;
|
||||
public Transform playerCameraTransform;
|
||||
public Transform mainCameraTransform;
|
||||
public Transform pivotCameraTransform;
|
||||
public Transform playerCameraTransform;
|
||||
public Transform mainCameraTransform;
|
||||
|
||||
public Collider playerCollider;
|
||||
public Collider playerCollider;
|
||||
|
||||
GameObject currentLaser;
|
||||
GameObject currentLaser;
|
||||
|
||||
Vector3 laserPosition;
|
||||
laserDevice.laserType lasertype;
|
||||
Vector3 laserPosition;
|
||||
laserDevice.laserType lasertype;
|
||||
|
||||
RaycastHit hit;
|
||||
RaycastHit hit;
|
||||
|
||||
|
||||
public override void updateAbilityState ()
|
||||
{
|
||||
//enable shield when the player touch a laser
|
||||
if (shield.activeSelf && currentLaser != null) {
|
||||
Vector3 targetDir = currentLaser.transform.position - shield.transform.position;
|
||||
public override void updateAbilityState ()
|
||||
{
|
||||
//enable shield when the player touch a laser
|
||||
if (shield.activeSelf && currentLaser != null) {
|
||||
Vector3 targetDir = currentLaser.transform.position - shield.transform.position;
|
||||
|
||||
Quaternion qTo = Quaternion.LookRotation (targetDir);
|
||||
Quaternion qTo = Quaternion.LookRotation (targetDir);
|
||||
|
||||
shield.transform.rotation = Quaternion.Slerp (shield.transform.rotation, qTo, 10 * Time.deltaTime);
|
||||
}
|
||||
shield.transform.rotation = Quaternion.Slerp (shield.transform.rotation, qTo, 10 * Time.deltaTime);
|
||||
}
|
||||
|
||||
//if the shield is enabled, the power decreases
|
||||
if (shield.activeSelf && shieldActive && !laserActive) {
|
||||
//also, rotates the shield towards the camera direction
|
||||
if (pivotCameraTransform.localRotation.x < 0) {
|
||||
shield.transform.rotation = pivotCameraTransform.rotation;
|
||||
} else {
|
||||
shield.transform.rotation = Quaternion.Euler (playerCameraTransform.eulerAngles);
|
||||
}
|
||||
//if the shield is enabled, the power decreases
|
||||
if (shield.activeSelf && shieldActive && !laserActive) {
|
||||
//also, rotates the shield towards the camera direction
|
||||
if (pivotCameraTransform.localRotation.x < 0) {
|
||||
shield.transform.rotation = pivotCameraTransform.rotation;
|
||||
} else {
|
||||
shield.transform.rotation = Quaternion.Euler (playerCameraTransform.eulerAngles);
|
||||
}
|
||||
|
||||
bool updateAbilityEnergyResult =
|
||||
mainPlayerAbilitiesSystem.checkAbilityUseEnergyInUpdate (useEnergyOnAbility, useEnergyWithRate, energyAmountUsed);
|
||||
bool updateAbilityEnergyResult =
|
||||
mainPlayerAbilitiesSystem.checkAbilityUseEnergyInUpdate (useEnergyOnAbility, useEnergyWithRate, energyAmountUsed);
|
||||
|
||||
if (!updateAbilityEnergyResult) {
|
||||
deactivateAbility ();
|
||||
}
|
||||
}
|
||||
if (!updateAbilityEnergyResult) {
|
||||
deactivateAbility ();
|
||||
}
|
||||
}
|
||||
|
||||
if (mainOtherPowers.isAimingPower ()) {
|
||||
//if the player is touching by a laser device, enable the laser in the player
|
||||
if (laserActive && !playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (true);
|
||||
}
|
||||
if (mainOtherPowers.isAimingPower ()) {
|
||||
//if the player is touching by a laser device, enable the laser in the player
|
||||
if (laserActive && !playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (true);
|
||||
}
|
||||
|
||||
//else disable the laser
|
||||
if (!laserActive && playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
} else {
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
//else disable the laser
|
||||
if (!laserActive && playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
} else {
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//enable and disable the shield when the player want to stop attacks or when he touchs a laser
|
||||
public void setActiveShieldState (bool state)
|
||||
{
|
||||
//enable or disable the shield
|
||||
if (!mainPlayerAbilitiesSystem.isPlayerCurrentlyBusy ()) {
|
||||
setShieldState (state);
|
||||
}
|
||||
}
|
||||
//enable and disable the shield when the player want to stop attacks or when he touchs a laser
|
||||
public void setActiveShieldState (bool state)
|
||||
{
|
||||
//enable or disable the shield
|
||||
if (!mainPlayerAbilitiesSystem.isPlayerCurrentlyBusy ()) {
|
||||
setShieldState (state);
|
||||
}
|
||||
}
|
||||
|
||||
public void setShieldState (bool state)
|
||||
{
|
||||
if (!laserActive && mainPlayerAbilitiesSystem.canMove && shieldEnabled) {
|
||||
shieldActive = state;
|
||||
public void setShieldState (bool state)
|
||||
{
|
||||
if (!laserActive && mainPlayerAbilitiesSystem.getCanMove () && shieldEnabled) {
|
||||
shieldActive = state;
|
||||
|
||||
if (shield.activeSelf != shieldActive) {
|
||||
shield.SetActive (shieldActive);
|
||||
}
|
||||
if (shield.activeSelf != shieldActive) {
|
||||
shield.SetActive (shieldActive);
|
||||
}
|
||||
|
||||
checkIfDestroyProjectiles ();
|
||||
}
|
||||
}
|
||||
|
||||
//enable disable the laser in the hand of the player, when he is in the range of one
|
||||
public void activateLaserForceField (Vector3 pos)
|
||||
{
|
||||
if (!laserAbilityEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isCurrentAbility) {
|
||||
return;
|
||||
}
|
||||
|
||||
//print ("enable laser force field");
|
||||
shieldActive = false;
|
||||
|
||||
laserActive = true;
|
||||
|
||||
disableAbilityCurrentActiveFromPressState ();
|
||||
|
||||
if (laserActive) {
|
||||
if (!shield.activeSelf) {
|
||||
shield.SetActive (true);
|
||||
}
|
||||
|
||||
laserPosition = pos;
|
||||
}
|
||||
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
laserPlayerManager.setLaserInfo (lasertype, currentLaser, laserPosition);
|
||||
}
|
||||
|
||||
checkIfDestroyProjectiles ();
|
||||
}
|
||||
|
||||
void checkIfDestroyProjectiles ()
|
||||
{
|
||||
if (destroProjectilesStoredIfShieldDisabled) {
|
||||
armorSurfaceManager.destroyProjetilesOnShield ();
|
||||
}
|
||||
}
|
||||
|
||||
public void deactivateLaserForceField ()
|
||||
{
|
||||
//print ("disable laser force field");
|
||||
laserActive = false;
|
||||
|
||||
if (shield.activeSelf) {
|
||||
shield.SetActive (false);
|
||||
}
|
||||
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
|
||||
laserPlayerManager.removeLaserInfo ();
|
||||
}
|
||||
|
||||
public void setShieldEnabledState (bool state)
|
||||
{
|
||||
shieldEnabled = state;
|
||||
}
|
||||
|
||||
//shoot the bullets and missiles catched by the shield
|
||||
public void returnEnemyProjectiles ()
|
||||
{
|
||||
//the bullets and missiles from the enemies are stored in the shield, so if the player press the right button of the mouse
|
||||
//the shoots are sent to its owners if they still alive, else, the shoots are launched in the camera direction
|
||||
if (!mainPlayerAbilitiesSystem.isPlayerCurrentlyBusy () && shield.activeSelf && shieldActive && !laserActive) {
|
||||
if (armorSurfaceManager.thereAreProjectilesStored ()) {
|
||||
//check if a raycast hits a surface from the center of the screen to forward
|
||||
//to set the direction of the projectiles in the shield
|
||||
Vector3 direction = mainCameraTransform.TransformDirection (Vector3.forward);
|
||||
|
||||
bool surfaceFound = false;
|
||||
|
||||
Vector3 raycastPosition = mainCameraTransform.position;
|
||||
|
||||
if (Physics.Raycast (raycastPosition, direction, out hit, Mathf.Infinity, layerToDamage)) {
|
||||
if (hit.collider != playerCollider) {
|
||||
surfaceFound = true;
|
||||
} else {
|
||||
raycastPosition = hit.point + direction * 0.2f;
|
||||
|
||||
if (Physics.Raycast (raycastPosition, direction, out hit, Mathf.Infinity, layerToDamage)) {
|
||||
surfaceFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (surfaceFound) {
|
||||
direction = hit.point;
|
||||
}
|
||||
|
||||
armorSurfaceManager.throwProjectilesStored (direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the laser device that touch the player, not enemy lasers, and if the laser reflects in other surfaces or not
|
||||
public void setLaser (GameObject l, laserDevice.laserType type)
|
||||
{
|
||||
currentLaser = l;
|
||||
|
||||
lasertype = type;
|
||||
}
|
||||
|
||||
//set the number of refractions in the laser in another function
|
||||
public void setLaserRefractionLimit (int value)
|
||||
{
|
||||
laserPlayerManager.reflactionLimit = value + 1;
|
||||
}
|
||||
|
||||
public void setLaserAbilityEnabledState (bool state)
|
||||
{
|
||||
laserAbilityEnabled = state;
|
||||
}
|
||||
|
||||
public override void enableAbility ()
|
||||
{
|
||||
shieldEnabled = true;
|
||||
}
|
||||
|
||||
public override void disableAbility ()
|
||||
{
|
||||
shieldEnabled = false;
|
||||
|
||||
if (shieldActive) {
|
||||
setShieldState (false);
|
||||
}
|
||||
|
||||
deactivateLaserForceField ();
|
||||
}
|
||||
|
||||
public override void deactivateAbility ()
|
||||
{
|
||||
if (shieldActive) {
|
||||
setShieldState (false);
|
||||
}
|
||||
|
||||
deactivateLaserForceField ();
|
||||
}
|
||||
|
||||
public override void activateSecondaryActionOnAbility ()
|
||||
{
|
||||
returnEnemyProjectiles ();
|
||||
}
|
||||
|
||||
public override void useAbilityPressDown ()
|
||||
{
|
||||
if (shieldActive) {
|
||||
if (armorSurfaceManager.thereAreProjectilesStored ()) {
|
||||
if (returnProjectilesDetectedEnabled) {
|
||||
returnEnemyProjectiles ();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setActiveShieldState (!shieldActive);
|
||||
|
||||
checkUseEventOnUseAbility ();
|
||||
}
|
||||
|
||||
public override void useAbilityPressHold ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void useAbilityPressUp ()
|
||||
{
|
||||
checkIfDestroyProjectiles ();
|
||||
}
|
||||
}
|
||||
|
||||
//enable disable the laser in the hand of the player, when he is in the range of one
|
||||
public void activateLaserForceField (Vector3 pos)
|
||||
{
|
||||
if (!laserAbilityEnabled) {
|
||||
return;
|
||||
}
|
||||
|
||||
if (!isCurrentAbility) {
|
||||
return;
|
||||
}
|
||||
|
||||
//print ("enable laser force field");
|
||||
shieldActive = false;
|
||||
|
||||
laserActive = true;
|
||||
|
||||
disableAbilityCurrentActiveFromPressState ();
|
||||
|
||||
if (laserActive) {
|
||||
if (!shield.activeSelf) {
|
||||
shield.SetActive (true);
|
||||
}
|
||||
|
||||
laserPosition = pos;
|
||||
}
|
||||
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
laserPlayerManager.setLaserInfo (lasertype, currentLaser, laserPosition);
|
||||
}
|
||||
|
||||
checkIfDestroyProjectiles ();
|
||||
}
|
||||
|
||||
void checkIfDestroyProjectiles ()
|
||||
{
|
||||
if (destroProjectilesStoredIfShieldDisabled) {
|
||||
armorSurfaceManager.destroyProjetilesOnShield ();
|
||||
}
|
||||
}
|
||||
|
||||
public void deactivateLaserForceField ()
|
||||
{
|
||||
//print ("disable laser force field");
|
||||
laserActive = false;
|
||||
|
||||
if (shield.activeSelf) {
|
||||
shield.SetActive (false);
|
||||
}
|
||||
|
||||
if (playerLaserGameObject.activeSelf) {
|
||||
playerLaserGameObject.SetActive (false);
|
||||
}
|
||||
|
||||
laserPlayerManager.removeLaserInfo ();
|
||||
}
|
||||
|
||||
public void setShieldEnabledState (bool state)
|
||||
{
|
||||
shieldEnabled = state;
|
||||
}
|
||||
|
||||
//shoot the bullets and missiles catched by the shield
|
||||
public void returnEnemyProjectiles ()
|
||||
{
|
||||
//the bullets and missiles from the enemies are stored in the shield, so if the player press the right button of the mouse
|
||||
//the shoots are sent to its owners if they still alive, else, the shoots are launched in the camera direction
|
||||
if (!mainPlayerAbilitiesSystem.isPlayerCurrentlyBusy () && shield.activeSelf && shieldActive && !laserActive) {
|
||||
if (armorSurfaceManager.thereAreProjectilesStored ()) {
|
||||
//check if a raycast hits a surface from the center of the screen to forward
|
||||
//to set the direction of the projectiles in the shield
|
||||
Vector3 direction = mainCameraTransform.TransformDirection (Vector3.forward);
|
||||
|
||||
bool surfaceFound = false;
|
||||
|
||||
Vector3 raycastPosition = mainCameraTransform.position;
|
||||
|
||||
if (Physics.Raycast (raycastPosition, direction, out hit, Mathf.Infinity, layerToDamage)) {
|
||||
if (hit.collider != playerCollider) {
|
||||
surfaceFound = true;
|
||||
} else {
|
||||
raycastPosition = hit.point + direction * 0.2f;
|
||||
|
||||
if (Physics.Raycast (raycastPosition, direction, out hit, Mathf.Infinity, layerToDamage)) {
|
||||
surfaceFound = true;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (surfaceFound) {
|
||||
direction = hit.point;
|
||||
}
|
||||
|
||||
armorSurfaceManager.throwProjectilesStored (direction);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
//get the laser device that touch the player, not enemy lasers, and if the laser reflects in other surfaces or not
|
||||
public void setLaser (GameObject l, laserDevice.laserType type)
|
||||
{
|
||||
currentLaser = l;
|
||||
|
||||
lasertype = type;
|
||||
}
|
||||
|
||||
//set the number of refractions in the laser in another function
|
||||
public void setLaserRefractionLimit (int value)
|
||||
{
|
||||
laserPlayerManager.reflactionLimit = value + 1;
|
||||
}
|
||||
|
||||
public void setLaserAbilityEnabledState (bool state)
|
||||
{
|
||||
laserAbilityEnabled = state;
|
||||
}
|
||||
|
||||
public override void enableAbility ()
|
||||
{
|
||||
shieldEnabled = true;
|
||||
}
|
||||
|
||||
public override void disableAbility ()
|
||||
{
|
||||
shieldEnabled = false;
|
||||
|
||||
if (shieldActive) {
|
||||
setShieldState (false);
|
||||
}
|
||||
|
||||
deactivateLaserForceField ();
|
||||
}
|
||||
|
||||
public override void deactivateAbility ()
|
||||
{
|
||||
if (shieldActive) {
|
||||
setShieldState (false);
|
||||
}
|
||||
|
||||
deactivateLaserForceField ();
|
||||
}
|
||||
|
||||
public override void activateSecondaryActionOnAbility ()
|
||||
{
|
||||
returnEnemyProjectiles ();
|
||||
}
|
||||
|
||||
public override void useAbilityPressDown ()
|
||||
{
|
||||
if (shieldActive) {
|
||||
if (armorSurfaceManager.thereAreProjectilesStored ()) {
|
||||
if (returnProjectilesDetectedEnabled) {
|
||||
returnEnemyProjectiles ();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
setActiveShieldState (!shieldActive);
|
||||
|
||||
checkUseEventOnUseAbility ();
|
||||
}
|
||||
|
||||
public override void useAbilityPressHold ()
|
||||
{
|
||||
|
||||
}
|
||||
|
||||
public override void useAbilityPressUp ()
|
||||
{
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/playerShieldSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/playerStealthSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/playerTeleportSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -54,11 +54,8 @@ public class removeGravityFromCharacterSystem : MonoBehaviour
|
||||
if (hipsRigidbody != null) {
|
||||
hipsRigidbody.AddRelativeTorque (characterTransform.forward * extraTorqueForce, torqueForceMode);
|
||||
hipsRigidbody.AddRelativeTorque (characterTransform.right * extraTorqueForce, torqueForceMode);
|
||||
// hipsRigidbody.AddTorque (hipsRigidbody.transform.up * extraTorqueForce);
|
||||
}
|
||||
|
||||
// yield return new WaitForSeconds (removeGravityDuration);
|
||||
|
||||
bool targetReached = false;
|
||||
|
||||
float timer = 0;
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/removeGravityFromCharacterSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -0,0 +1,212 @@
|
||||
using System.Collections;
|
||||
using System.Collections.Generic;
|
||||
using UnityEngine;
|
||||
|
||||
public class removeGravityFromObjectSystem : MonoBehaviour
|
||||
{
|
||||
[Header ("Main Settings")]
|
||||
[Space]
|
||||
|
||||
public float removeGravityDuration = 5;
|
||||
|
||||
public float delayBeforeFreezingVelocity = 3;
|
||||
|
||||
public bool pauseExtraForceAfterDelay;
|
||||
|
||||
public float pauseExtraForceDelay;
|
||||
|
||||
[Space]
|
||||
|
||||
public bool setObjectAsKinematicOnZeroVelocity;
|
||||
|
||||
public float durationAsKinematic;
|
||||
|
||||
[Space]
|
||||
[Header ("Force Settings")]
|
||||
[Space]
|
||||
|
||||
public float pauseExtraForceSpeed = 3;
|
||||
|
||||
public float extraGravityForce = 5;
|
||||
|
||||
public float extraTorqueForce = 8;
|
||||
public ForceMode torqueForceMode;
|
||||
|
||||
public bool addTorqueOnRemoveGravity;
|
||||
|
||||
[Space]
|
||||
[Header ("Debug")]
|
||||
[Space]
|
||||
|
||||
public bool showDebugPrint;
|
||||
|
||||
public bool removeGravityActive;
|
||||
|
||||
[Space]
|
||||
[Header ("Components")]
|
||||
[Space]
|
||||
|
||||
public Rigidbody mainRigibody;
|
||||
|
||||
grabbedObjectState currentGrabbedObjectState;
|
||||
artificialObjectGravity currentArtificialObjectGravity;
|
||||
|
||||
Coroutine removeGravityCoroutine;
|
||||
|
||||
bool currentObjectWasInsideGravityRoom;
|
||||
|
||||
|
||||
public void activateRemoveGravity ()
|
||||
{
|
||||
stopRemoveGravityCoroutine ();
|
||||
|
||||
removeGravityCoroutine = StartCoroutine (activateRemoveGravityCoroutine ());
|
||||
}
|
||||
|
||||
void stopRemoveGravityCoroutine ()
|
||||
{
|
||||
if (removeGravityCoroutine != null) {
|
||||
StopCoroutine (removeGravityCoroutine);
|
||||
}
|
||||
|
||||
removeGravityActive = false;
|
||||
}
|
||||
|
||||
IEnumerator activateRemoveGravityCoroutine ()
|
||||
{
|
||||
removeGravity ();
|
||||
|
||||
Vector3 upDirection = Vector3.up;
|
||||
|
||||
if (currentArtificialObjectGravity != null) {
|
||||
upDirection = -currentArtificialObjectGravity.getCurrentNormalDirection ();
|
||||
}
|
||||
|
||||
Vector3 initialForce = upDirection * extraGravityForce;
|
||||
|
||||
if (mainRigibody == null) {
|
||||
mainRigibody = gameObject.GetComponent<Rigidbody> ();
|
||||
}
|
||||
|
||||
if (mainRigibody != null) {
|
||||
if (addTorqueOnRemoveGravity) {
|
||||
mainRigibody.AddRelativeTorque (transform.forward * extraTorqueForce, torqueForceMode);
|
||||
mainRigibody.AddRelativeTorque (transform.right * extraTorqueForce, torqueForceMode);
|
||||
} else {
|
||||
mainRigibody.AddForce (initialForce, torqueForceMode);
|
||||
}
|
||||
}
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("force applied, waiting for delayBeforeFreezingVelocity");
|
||||
}
|
||||
|
||||
yield return new WaitForSeconds (delayBeforeFreezingVelocity);
|
||||
|
||||
|
||||
bool targetReached = false;
|
||||
|
||||
float timer = 0;
|
||||
|
||||
bool pauseExtraForceActivated = false;
|
||||
|
||||
Vector3 currentVelocity = mainRigibody.linearVelocity;
|
||||
|
||||
while (!targetReached) {
|
||||
timer += Time.deltaTime;
|
||||
|
||||
if (pauseExtraForceAfterDelay) {
|
||||
if (pauseExtraForceActivated) {
|
||||
if (GKC_Utils.distance (currentVelocity, Vector3.zero) > 0.05f) {
|
||||
currentVelocity = Vector3.MoveTowards (currentVelocity, Vector3.zero, timer * pauseExtraForceSpeed);
|
||||
|
||||
mainRigibody.linearVelocity = currentVelocity;
|
||||
}
|
||||
} else {
|
||||
if (timer >= pauseExtraForceDelay) {
|
||||
pauseExtraForceActivated = true;
|
||||
|
||||
if (showDebugPrint) {
|
||||
print ("starting to decrease speed");
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (timer >= removeGravityDuration) {
|
||||
targetReached = true;
|
||||
}
|
||||
|
||||
yield return null;
|
||||
}
|
||||
|
||||
if (setObjectAsKinematicOnZeroVelocity) {
|
||||
mainRigibody.isKinematic = true;
|
||||
|
||||
yield return new WaitForSeconds (durationAsKinematic);
|
||||
|
||||
mainRigibody.isKinematic = false;
|
||||
}
|
||||
|
||||
resumePreviousGravity ();
|
||||
}
|
||||
|
||||
void removeGravity ()
|
||||
{
|
||||
if (removeGravityActive) {
|
||||
return;
|
||||
}
|
||||
|
||||
removeGravityActive = true;
|
||||
|
||||
currentGrabbedObjectState = gameObject.GetComponent<grabbedObjectState> ();
|
||||
|
||||
currentObjectWasInsideGravityRoom = false;
|
||||
|
||||
if (currentGrabbedObjectState != null) {
|
||||
currentObjectWasInsideGravityRoom = currentGrabbedObjectState.isInsideZeroGravityRoom ();
|
||||
}
|
||||
|
||||
if (currentObjectWasInsideGravityRoom) {
|
||||
if (currentGrabbedObjectState.getCurrentZeroGravityRoom ().isRoomHasZeroGravityActive ()) {
|
||||
|
||||
stopRemoveGravityCoroutine ();
|
||||
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
currentArtificialObjectGravity = gameObject.GetComponent<artificialObjectGravity> ();
|
||||
|
||||
if (currentArtificialObjectGravity != null) {
|
||||
currentArtificialObjectGravity.setActiveState (false);
|
||||
}
|
||||
|
||||
mainRigibody.useGravity = false;
|
||||
}
|
||||
|
||||
void resumePreviousGravity ()
|
||||
{
|
||||
bool useGravityResult = false;
|
||||
|
||||
currentArtificialObjectGravity = gameObject.GetComponent<artificialObjectGravity> ();
|
||||
|
||||
if (currentArtificialObjectGravity != null) {
|
||||
currentArtificialObjectGravity.setActiveState (true);
|
||||
} else {
|
||||
useGravityResult = true;
|
||||
}
|
||||
|
||||
if (currentObjectWasInsideGravityRoom) {
|
||||
useGravityResult = false;
|
||||
}
|
||||
|
||||
mainRigibody.useGravity = useGravityResult;
|
||||
|
||||
removeGravityActive = false;
|
||||
|
||||
if (setObjectAsKinematicOnZeroVelocity) {
|
||||
mainRigibody.isKinematic = false;
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,19 @@
|
||||
fileFormatVersion: 2
|
||||
guid: 7415783b8417e84448dc1230095866de
|
||||
MonoImporter:
|
||||
externalObjects: {}
|
||||
serializedVersion: 2
|
||||
defaultReferences: []
|
||||
executionOrder: 0
|
||||
icon: {instanceID: 0}
|
||||
userData:
|
||||
assetBundleName:
|
||||
assetBundleVariant:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/removeGravityFromObjectSystem.cs
|
||||
uploadId: 889948
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/simpleLaser.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/slowDownAllAIOnSceneSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/stealObjectFromCharacterSystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
@@ -13,7 +13,8 @@ MonoImporter:
|
||||
AssetOrigin:
|
||||
serializedVersion: 1
|
||||
productId: 40995
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure Creator 3D + 2.5D
|
||||
packageVersion: 3.77g
|
||||
packageName: Game Kit Controller - Shooter Melee Adventure FPS TPS Creator 3D +
|
||||
2.5D
|
||||
packageVersion: 3.77h
|
||||
assetPath: Assets/Game Kit Controller/Scripts/Abilities System/Custom Abilities/templateAbilitySystem.cs
|
||||
uploadId: 814740
|
||||
uploadId: 889948
|
||||
|
||||
Reference in New Issue
Block a user