73 lines
2.0 KiB
C#
73 lines
2.0 KiB
C#
using System.Collections;
|
|
using System.Collections.Generic;
|
|
using Assets.HeroEditor4D.Common.Scripts.CharacterScripts;
|
|
using Assets.HeroEditor4D.Common.Scripts.Common;
|
|
using Assets.HeroEditor4D.Common.Scripts.Data;
|
|
using Assets.HeroEditor4D.Common.Scripts.Enums;
|
|
using Assets.HeroEditor4D.InventorySystem.Scripts.Elements;
|
|
using UnityEngine;
|
|
|
|
public class characterManager : MonoBehaviour
|
|
{
|
|
public Character4D character;
|
|
public AnimationManager anim;
|
|
public Character front, back, left, right;
|
|
|
|
float xMove , yMove;
|
|
|
|
void Start(){
|
|
// if(CharacterCusomizationBridge.instance!=null && CharacterCusomizationBridge.characterJson!=null){
|
|
// GetComponent<Character4D>().FromJson(CharacterCusomizationBridge.characterJson, false);
|
|
// }
|
|
}
|
|
|
|
void Update(){
|
|
|
|
if(Input.GetKeyDown(KeyCode.M)){
|
|
// ChangeWeapon();
|
|
EquipBow();
|
|
}
|
|
}
|
|
int weaponIndex = 52;
|
|
public int bowIndex =0;
|
|
public void EquipBow(){
|
|
// bowIndex++;
|
|
// if(bowIndex >= character.SpriteCollection.Bow.Count){
|
|
// bowIndex=0;
|
|
// }
|
|
// Debug.Log("Equipping bow index " + bowIndex + " out of " + character.SpriteCollection.Bow.Count);
|
|
|
|
var item = character.SpriteCollection.Bow[16];
|
|
EquipForAll(item, EquipmentPart.Bow);
|
|
|
|
|
|
}
|
|
|
|
void ChangeWeapon(){
|
|
|
|
// if(weaponIndex < character.SpriteCollection.MeleeWeapon1H.Count){
|
|
// weaponIndex++;
|
|
// }else{
|
|
// weaponIndex = 0;
|
|
// }
|
|
// Debug.Log(weaponIndex);
|
|
var item = character.SpriteCollection.MeleeWeapon1H[weaponIndex];
|
|
// var sprite = character.SpriteCollection.MeleeWeapon1H.FindSprite("FireMageWand");
|
|
|
|
EquipForAll(item,EquipmentPart.MeleeWeapon1H);
|
|
}
|
|
|
|
void EquipForAll(ItemSprite item, EquipmentPart type){
|
|
front.Equip(item, type);
|
|
back.Equip(item, type);
|
|
left.Equip(item, type);
|
|
right.Equip(item, type);
|
|
|
|
}
|
|
|
|
public void SetActiveWeapon(int i){
|
|
weaponIndex = i;
|
|
ChangeWeapon();
|
|
}
|
|
}
|