Атаки кристаллов разных цветов.

This commit is contained in:
DyatelO 2021-11-10 11:47:53 +03:00
parent f41719fd8d
commit efebc2012b
10 changed files with 133 additions and 18 deletions

View File

@ -83,6 +83,7 @@ MonoBehaviour:
defaultAction: {fileID: 11400000, guid: 92504437725aa854c98196750a332319, type: 2}
currentAction: {fileID: 0}
enemies: []
_crystalls: []
--- !u!114 &9168429453977567459
MonoBehaviour:
m_ObjectHideFlags: 0
@ -111,7 +112,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
enemyCaptureTime: 1
capVFX: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4, type: 3}
capVFX: {fileID: 5732852186060375560, guid: 54d847a18c62f57479c53469d4398ceb, type: 3}
_ac: {fileID: 8981675715780948568}
--- !u!114 &6646124388588297559
MonoBehaviour:

View File

@ -196,6 +196,7 @@ MonoBehaviour:
defaultAction: {fileID: 11400000, guid: 92504437725aa854c98196750a332319, type: 2}
currentAction: {fileID: 0}
enemies: []
_crystalls: []
--- !u!114 &2376185860839512057
MonoBehaviour:
m_ObjectHideFlags: 0
@ -224,7 +225,7 @@ MonoBehaviour:
m_Name:
m_EditorClassIdentifier:
enemyCaptureTime: 1
capVFX: {fileID: 1651852338557341938, guid: fa6c1fc3da7c8d24c85a88b00cf598d4, type: 3}
capVFX: {fileID: 8021195855904498788, guid: 2f6d0540c8fd7bb46b356ff86962379c, type: 3}
_ac: {fileID: 7509513666596637474}
--- !u!114 &7753066097015895260
MonoBehaviour:

View File

@ -0,0 +1,22 @@
%YAML 1.1
%TAG !u! tag:unity3d.com,2011:
--- !u!114 &11400000
MonoBehaviour:
m_ObjectHideFlags: 0
m_CorrespondingSourceObject: {fileID: 0}
m_PrefabInstance: {fileID: 0}
m_PrefabAsset: {fileID: 0}
m_GameObject: {fileID: 0}
m_Enabled: 1
m_EditorHideFlags: 0
m_Script: {fileID: 11500000, guid: edec6846e70b8c6408283a80751a8b81, type: 3}
m_Name: TowerCrystallAttack
m_EditorClassIdentifier:
duration: 0.6
distance: 2
actionType: 1
standartAttackPref: {fileID: 8121987183708165570, guid: 9b1736dcfdc57a942840ff040a0d4cc7,
type: 3}
standartAttackGroundImpact: {fileID: 309578085925084758, guid: 3a909a798f418024fa81484aff623108,
type: 3}
throw_SFX: {fileID: 0}

View File

@ -0,0 +1,8 @@
fileFormatVersion: 2
guid: f7a96d7d7fba39d4cb0137e81e70e830
NativeFormatImporter:
externalObjects: {}
mainObjectFileID: 11400000
userData:
assetBundleName:
assetBundleVariant:

View File

@ -133,7 +133,7 @@ MonoBehaviour:
currentTile: {fileID: 0}
targetMoveTile: {fileID: 0}
currentActionTarget: {fileID: 0}
defaultAction: {fileID: 11400000, guid: aa2f04e23889dba4ba225ceac2b7275b, type: 2}
defaultAction: {fileID: 11400000, guid: f7a96d7d7fba39d4cb0137e81e70e830, type: 2}
currentAction: {fileID: 0}
enemies: []
_crystalls: []

View File

@ -32,11 +32,11 @@ Transform:
m_LocalPosition: {x: 0, y: 0, z: 0}
m_LocalScale: {x: 1, y: 1, z: 1}
m_Children:
- {fileID: 3560900723245820978}
- {fileID: 8366447193029498276}
- {fileID: 4665280019363295353}
- {fileID: 5834686163564528828}
- {fileID: 3387702041049523021}
- {fileID: 4665280019363295353}
- {fileID: 8366447193029498276}
- {fileID: 3560900723245820978}
m_Father: {fileID: 0}
m_RootOrder: 0
m_LocalEulerAnglesHint: {x: 0, y: 0, z: 0}
@ -81,7 +81,7 @@ MonoBehaviour:
m_Script: {fileID: 11500000, guid: bf6b2684c40d43445a596c28df81c05b, type: 3}
m_Name:
m_EditorClassIdentifier:
owner: 0
owner: 1
velocity: 20
damage: 440
--- !u!114 &1813624109411210032
@ -133,7 +133,7 @@ PrefabInstance:
- target: {fileID: 5675810155635618525, guid: dabd2db5af864be40b33d846618cd372,
type: 3}
propertyPath: m_RootOrder
value: 2
value: 1
objectReference: {fileID: 0}
- target: {fileID: 5675810155635618525, guid: dabd2db5af864be40b33d846618cd372,
type: 3}
@ -203,7 +203,7 @@ PrefabInstance:
- target: {fileID: 7042033215325559829, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_RootOrder
value: 4
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042033215325559829, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
@ -240,16 +240,26 @@ PrefabInstance:
propertyPath: m_LocalRotation.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042033215325559829, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.x
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042033215325559829, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.y
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042033215325559829, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_LocalEulerAnglesHint.z
value: 0
objectReference: {fileID: 0}
- target: {fileID: 7042033215325622837, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_Name
value: FireballMissileRed
objectReference: {fileID: 0}
- target: {fileID: 7042033215325622837, guid: cf0b8eee8b981b04b963961eded1ee9c,
type: 3}
propertyPath: m_IsActive
value: 1
objectReference: {fileID: 0}
m_RemovedComponents: []
m_SourcePrefab: {fileID: 100100000, guid: cf0b8eee8b981b04b963961eded1ee9c, type: 3}
--- !u!4 &4665280019363295353 stripped
@ -268,7 +278,7 @@ PrefabInstance:
- target: {fileID: 8186924384097782907, guid: ae7ae5ea0ae7cd34abc05e19304d5600,
type: 3}
propertyPath: m_RootOrder
value: 3
value: 2
objectReference: {fileID: 0}
- target: {fileID: 8186924384097782907, guid: ae7ae5ea0ae7cd34abc05e19304d5600,
type: 3}
@ -358,7 +368,7 @@ PrefabInstance:
- target: {fileID: 1899256003546783445, guid: e433f487ec2dc67409795011e08dd4dc,
type: 3}
propertyPath: m_RootOrder
value: 1
value: 3
objectReference: {fileID: 0}
- target: {fileID: 1899256003546783445, guid: e433f487ec2dc67409795011e08dd4dc,
type: 3}
@ -428,7 +438,7 @@ PrefabInstance:
- target: {fileID: 4746165193703840883, guid: 4e7523811a052fd46acf941fc69c8c98,
type: 3}
propertyPath: m_RootOrder
value: 0
value: 4
objectReference: {fileID: 0}
- target: {fileID: 4746165193703840883, guid: 4e7523811a052fd46acf941fc69c8c98,
type: 3}

View File

@ -20,7 +20,7 @@ GameObject:
m_Icon: {fileID: 0}
m_NavMeshLayer: 0
m_StaticEditorFlags: 0
m_IsActive: 1
m_IsActive: 0
--- !u!4 &7042033215325559829
Transform:
m_ObjectHideFlags: 0

View File

@ -20,6 +20,7 @@ public class Attack : PlayerAction
if (!targetTile)
return false;
bool permission = base.IsActionAllowed(targetTile, playerState);
//bool isMyTile = targetTile.tileOwnerIndex == playerState.ownerIndex; && isMyTile
permission = permission && targetTile.canBeAttacked;
return permission;
}
@ -27,6 +28,7 @@ public class Attack : PlayerAction
public override void StartActionOperations(TileInfo targetTile, PlayerState currentPlayer)
{
base.StartActionOperations(targetTile, currentPlayer);
//currentPlayer.GetComponent<AudioController>().PlaySound(throw_SFX);
}
@ -43,6 +45,9 @@ public class Attack : PlayerAction
{
var currentProjectile = Instantiate(standartAttackPref, startPosition, standartAttackPref.transform.rotation).GetComponent<ProjectileController>();
currentProjectile.SetinitialParams(projOwner, direction, TileManagment.tileOffset);
//
//
Instantiate(standartAttackGroundImpact, startPosition, standartAttackGroundImpact.transform.rotation);
}

View File

@ -0,0 +1,57 @@
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
[CreateAssetMenu(fileName = "New TowerAttack", menuName = "Actions/New TowerAttack")]
public class TowerAttack : PlayerAction
{
public GameObject standartAttackPref;
public GameObject standartAttackGroundImpact;
public AudioClip throw_SFX;
//
//[SerializeField] private Transform _offset;
public override bool IsActionAllowed(TileInfo targetTile, PlayerState playerState)
{
if (!targetTile)
return false;
bool permission = base.IsActionAllowed(targetTile, playerState);
//bool isMyTile = targetTile.tileOwnerIndex == playerState.ownerIndex; && isMyTile
permission = permission && targetTile.canBeAttacked;
return permission;
}
public override void StartActionOperations(TileInfo targetTile, PlayerState currentPlayer)
{
base.StartActionOperations(targetTile, currentPlayer);
//currentPlayer.GetComponent<AudioController>().PlaySound(throw_SFX);
}
public override void Impact(TileInfo targetTile, PlayerState currentPlayer)
{
base.Impact(targetTile, currentPlayer);
Vector3 direction = (targetTile.tilePosition ) - currentPlayer.currentTile.tilePosition ;
InitAttack(currentPlayer.currentTile.tilePosition, direction , currentPlayer.ownerIndex);
//currentPlayer.GetComponent<AudioController>().PlaySound(throw_SFX);
}
private void InitAttack(Vector3 startPosition, Vector3 direction, TileOwner projOwner)
{
var currentProjectile = Instantiate(standartAttackPref, startPosition, standartAttackPref.transform.rotation).GetComponent<ProjectileController>();
currentProjectile.SetinitialParams(projOwner, direction, TileManagment.tileOffset);
//
currentProjectile.GetComponent<ProjectileController>().owner = projOwner;
int activeModelIndex = (int)projOwner - 1;
currentProjectile.transform.GetChild(activeModelIndex).gameObject.SetActive(true);
//
Instantiate(standartAttackGroundImpact, startPosition, standartAttackGroundImpact.transform.rotation);
}
}

View File

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