50 lines
1.4 KiB
Plaintext
50 lines
1.4 KiB
Plaintext
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using UnityEngine;
|
|
|
|
public class PuzzleSkillDisplayer : MonoBehaviour
|
|
{
|
|
public PuzzleHero Hero;
|
|
public Board currBoard;
|
|
public SpriteRenderer HeroImage;
|
|
public int startRow;
|
|
public int startColumn;
|
|
// Start is called before the first frame update
|
|
public void SetHero(PuzzleHero hero,Board board,int row,int column)
|
|
{
|
|
Hero = hero;
|
|
hero.Displayer = this;
|
|
currBoard = board;
|
|
startRow = row;
|
|
startColumn = column;
|
|
SkillConfig? config = PuzzleGameMode.main.GetSkillConfig(hero.AttackSkillID);
|
|
if (config == null)
|
|
{
|
|
return;
|
|
}
|
|
HeroImage.size = new Vector2(board.NodeSize()*config.Value.SkillSize.y,board.NodeSize()*config.Value.SkillSize.x);
|
|
HeroImage.GetComponent<BoxCollider2D>().size = HeroImage.size;
|
|
HeroImage.sprite = config.Value.SkillCardImage ? config.Value.SkillCardImage : Hero.Icon.Value;
|
|
}
|
|
|
|
|
|
public void TryCastSkill()
|
|
{
|
|
// if(Timer<ClickGap)return;
|
|
PuzzleGameMode.main.PlayerCastSkill(Hero, Hero.AttackSkillID,currBoard);
|
|
}
|
|
|
|
|
|
// float Timer;
|
|
// float ClickGap = 1f;
|
|
// /// <summary>
|
|
// /// Update is called every frame, if the MonoBehaviour is enabled.
|
|
// /// </summary>
|
|
// void Update()
|
|
// {
|
|
// if(Timer<ClickGap){
|
|
// Timer+= Time.deltaTime;
|
|
// }
|
|
// }
|
|
}
|