From 6f16dfb8bcebe67aeb95ded0d8b644af4932e690 Mon Sep 17 00:00:00 2001 From: chenxin <chenxin6991@163.com> Date: Mon, 26 Oct 2020 21:00:32 +0800 Subject: [PATCH] 无尽模式新手步骤到水元素放置塔位完成 --- Assets/Scripts/TowerDefense/Towers/Placement/IPlacementArea.cs | 241 ++++++++++++++++++++++++------------------------ 1 files changed, 121 insertions(+), 120 deletions(-) diff --git a/Assets/Scripts/TowerDefense/Towers/Placement/IPlacementArea.cs b/Assets/Scripts/TowerDefense/Towers/Placement/IPlacementArea.cs index 30eb5cf..acfa4c6 100644 --- a/Assets/Scripts/TowerDefense/Towers/Placement/IPlacementArea.cs +++ b/Assets/Scripts/TowerDefense/Towers/Placement/IPlacementArea.cs @@ -3,145 +3,146 @@ namespace TowerDefense.Towers.Placement { - /// <summary> - /// An interface for a placement area that can contain a tower - /// </summary> - public interface IPlacementArea - { - /// <summary> - /// Gets this object's transform - /// </summary> - Transform transform { get; } + /// <summary> + /// An interface for a placement area that can contain a tower + /// </summary> + public interface IPlacementArea + { + /// <summary> + /// Gets this object's transform + /// </summary> + Transform transform { get; } - /// <summary> - /// 获取当前PlaceMentArea的Size. - /// </summary> - IntVector2 getdimsize(); + /// <summary> + /// 获取当前PlaceMentArea的Size. + /// </summary> + IntVector2 getdimsize(); - /// <summary> - /// 获取一个可以放置塔防的位置. - /// </summary> - /// <returns></returns> - IntVector2 getFreePos(int xdim,int ydim,bool forceGet = false ); + /// <summary> + /// 获取一个可以放置塔防的位置. + /// </summary> + /// <returns></returns> + IntVector2 getFreePos(int xdim, int ydim, bool forceGet = false); - /// <summary> - /// 获取对应位置的充能子弹界面指针. - /// </summary> - /// <param name="x"></param> - /// <returns></returns> - BulletUICtl GetBulletUICtl(int x); + /// <summary> + /// 获取对应位置的充能子弹界面指针. + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + BulletUICtl GetBulletUICtl(int x, int y); - /// <summary> - /// 获取对应位置的能量条界面指针. - /// </summary> - /// <param name="x"></param> - /// <returns></returns> - EnergyUICtl GetEnergyUICtl(int x); + /// <summary> + /// 获取对应位置的能量条界面指针. + /// </summary> + /// <param name="x"></param> + /// <returns></returns> + EnergyUICtl GetEnergyUICtl(int x, int y); - /// <summary> - /// 是否空置的攻击位 - /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> - /// <returns></returns> - bool isFreeAtackPos(int x, int y); + /// <summary> + /// 是否空置的攻击位 + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + bool isFreeAtackPos(int x, int y); - /// <summary> - /// 是否有已开启的可放置攻击位置。 - /// </summary> - /// <returns></returns> - bool hasFreeAttackPos(); + /// <summary> + /// 是否有已开启的可放置攻击位置。 + /// </summary> + /// <returns></returns> + bool hasFreeAttackPos(); - /// <summary> - /// 是否是等待购买的攻击塔位. - /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> - /// <returns></returns> - bool isWaitBuyGrid(int x, int y); + /// <summary> + /// 是否是等待购买的攻击塔位. + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + bool isWaitBuyGrid(int x, int y); - void startCoinGenMode(); + void startCoinGenMode(); - /// <summary> - /// 购买对应的待购攻击塔位. - /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> - /// <returns></returns> - bool buyWaitBuyGrid(int x, int y); + /// <summary> + /// 购买对应的待购攻击塔位. + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + bool buyWaitBuyGrid(int x, int y); - /// <summary> - /// 设置某一个格子为已破坏塔位。 - /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> - /// <returns></returns> - bool SetDestroyedGrid(int x, int y ); + /// <summary> + /// 设置某一个格子为已破坏塔位。 + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + bool SetDestroyedGrid(int x, int y); - /// <summary> - /// 设置格子为合成状态。 - /// </summary> - /// <param name="x"></param> - /// <param name="y"></param> - /// <returns></returns> - bool SetComboGrid(int x, int y); + /// <summary> + /// 设置格子为合成状态。 + /// </summary> + /// <param name="x"></param> + /// <param name="y"></param> + /// <returns></returns> + bool SetComboGrid(int x, int y); - /// <summary> - /// 设置塔位的血条血量数据 - /// </summary> - /// <param name="ix"></param> - /// <param name="health"></param> - void setTowerPosHealth(int ix, float health); + /// <summary> + /// 设置塔位的血条血量数据 + /// </summary> + /// <param name="ix"></param> + /// <param name="health"></param> + void setTowerPosHealth(int ix, float health); - /// <summary> - /// Calculates the grid position from a given world position, offset to center for a specific size object - /// </summary> - IntVector2 WorldToGrid(Vector3 worldPosition, IntVector2 sizeOffset); + /// <summary> + /// Calculates the grid position from a given world position, offset to center for a specific size object + /// </summary> + IntVector2 WorldToGrid(Vector3 worldPosition, IntVector2 sizeOffset); - /// <summary> - /// Calculates the snapped world position from a given grid position - /// </summary> - Vector3 GridToWorld(IntVector2 gridPosition, IntVector2 sizeOffset); + /// <summary> + /// Calculates the snapped world position from a given grid position + /// </summary> + Vector3 GridToWorld(IntVector2 gridPosition, IntVector2 sizeOffset); - /// <summary> - /// 当前是否是反方的TowerPlacementGrid. - /// </summary> - bool isOpponent(); + /// <summary> + /// 当前是否是反方的TowerPlacementGrid. + /// </summary> + bool isOpponent(); - /// <summary> - /// Gets whether an object of a given size would fit on this grid at the given location - /// </summary> - /// <param name="gridPos">The grid location</param> - /// <param name="size">The size of the item</param> - /// <returns>True if the item would fit at <paramref name="gridPos"/></returns> - TowerFitStatus Fits(IntVector2 gridPos, IntVector2 size); + /// <summary> + /// Gets whether an object of a given size would fit on this grid at the given location + /// </summary> + /// <param name="gridPos">The grid location</param> + /// <param name="size">The size of the item</param> + /// <returns>True if the item would fit at <paramref name="gridPos"/></returns> + TowerFitStatus Fits(IntVector2 gridPos, IntVector2 size); - /// <summary> - /// Occupy the given space on this placement area - /// </summary> - /// <param name="gridPos">The grid location</param> - /// <param name="size">The size of the item</param> - void Occupy(IntVector2 gridPos, IntVector2 size); + /// <summary> + /// Occupy the given space on this placement area + /// </summary> + /// <param name="gridPos">The grid location</param> + /// <param name="size">The size of the item</param> + void Occupy(IntVector2 gridPos, IntVector2 size); - /// <summary> - /// Clear the given space on this placement area - /// </summary> - /// <param name="gridPos">The grid location</param> - /// <param name="size">The size of the item</param> - void Clear(IntVector2 gridPos, IntVector2 size); - } + /// <summary> + /// Clear the given space on this placement area + /// </summary> + /// <param name="gridPos">The grid location</param> + /// <param name="size">The size of the item</param> + void Clear(IntVector2 gridPos, IntVector2 size); + } - public static class PlacementAreaExtensions - { - /// <summary> - /// Snaps a given world positionn to this grid - /// </summary> - public static Vector3 Snap(this IPlacementArea placementArea, Vector3 worldPosition, IntVector2 sizeOffset) - { - // Calculate the nearest grid location and then change that back to world space - return placementArea.GridToWorld(placementArea.WorldToGrid(worldPosition, sizeOffset), sizeOffset); - } - } + public static class PlacementAreaExtensions + { + /// <summary> + /// Snaps a given world positionn to this grid + /// </summary> + public static Vector3 Snap(this IPlacementArea placementArea, Vector3 worldPosition, IntVector2 sizeOffset) + { + // Calculate the nearest grid location and then change that back to world space + return placementArea.GridToWorld(placementArea.WorldToGrid(worldPosition, sizeOffset), sizeOffset); + } + } } \ No newline at end of file -- Gitblit v1.9.1