public void Construct() { _unit = BattleProcedure.CurSession.Field.FindUnit(_casterUid); _time = 0f; _stage = 1; bCompleted = false; }
public void BindUnit(UnitAvatar unit) { _master = unit; _nameText.text = _master.Name; RefreshHp(); RefreshEnergy(); _selectFlag.SetActive(false); _actFlag.SetActive(false); }
public MoveAnimation(Unit unit, TileVector origin, TileVector destination, CardinalDirection direction, int energyCost) { _avatar = unit.Avatar; _targetPos = destination.ToVector3(); _targetRot = direction.GetBearingRotation(); // TODO: implement energycost, advanced bar animation _targetEnergy = unit.Energy; _isStep = origin != destination; moveSound = _avatar.moveSound; }
//===================== unit function ================================ public void CreateUnit(int uid, UnitVO unitVO, MapCoordinates createPos) { ResourceManager.Instance.LoadAssetAsync(unitVO.prefabPath, (asset) => { GameObject obj = Instantiate(asset) as GameObject; UnitAvatar avatar = obj.AddComponent <UnitAvatar>(); avatar.UnitPos = createPos; Unit unit = new Unit(); unit.vo = unitVO; unit.avatar = avatar; unit.pos = createPos; unitMap.Add(uid, unit); obj.transform.SetParent(mapGrid.MapUnitRoot.transform); obj.transform.position = createPos.WorldPosition; SetMapCellState(createPos, MapCellState.Occupy); GetMapCellData(createPos).unit = unit; }); }
public readonly UnitAvatar Avatar; // Unity representation public Unit(UnitAvatar avatar, Player owner, TileVector position, CardinalDirection facing, bool mirrored) { // IMPLEMENTATION NOTE: Unit construction should not have any side effects. if you need to keep track // of new units being created, you should call that from WorldController.AddUnit. Avatar = avatar; _moveMethod = Avatar.Ai.GetMovementPlan; Owner = owner; Position = position; Facing = facing; MaxHealth = Avatar.MaxHealth; Health = MaxHealth; MaxEnergy = Avatar.MaxEnergy; Energy = MaxEnergy; Mirrored = mirrored; }
protected SyncedAnimation(UnitAvatar owner, UnitAvatar target) { Owner = owner; Target = target; }
public void Construct() { _unit = BattleProcedure.CurSession.Field.FindUnit(_targetUid); bCompleted = false; }
public DeployAnimation(UnitAvatar unit) { _unit = unit; deploySound = _unit.inSound; }
public DestroyAnimation(UnitAvatar target) { _target = target; }