本文整理汇总了C#中Move.isDirectional方法的典型用法代码示例。如果您正苦于以下问题:C# Move.isDirectional方法的具体用法?C# Move.isDirectional怎么用?C# Move.isDirectional使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Move
的用法示例。
在下文中一共展示了Move.isDirectional方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AttemptMove
protected override bool AttemptMove(Move move)
{
if (move == lastMove)
{
combo++;
//Debug.Log(combo + "x COMBO!");
}
else
{
lastMove = move;
combo = fullCombo / 4;
//Debug.Log("Combo reset to " + combo);
}
fullCombo++;
if (move == Move.Heal) {
health += healAmount + (combo * healIncrease);
//1 and 2 are 5 less than before; 3 is the same; 4 and higher are more.
if(health > maxHealth)
health = maxHealth;
Instantiate(healingEffect, transform.position + new Vector3(0, 0, .5f), Quaternion.identity);
return true;
}
else
{
bool success = false;
if(move == Move.Fight && combo > 2)
{
//Debug.Log("AoE triggered!");
//play an obscenity
//i.e. the fourth or later punch in a row
List<Entity> closeEntities = GridManager.instance.getEntitiesInRect(x - 2, x + 2, y + 2, y - 2);
foreach(Entity entity in closeEntities)
{
if(entity != null)
{
if(entity.gameObject.tag == foeTag)
{
entity.takeDamage(10);
success = true;
}
}
}
animator.Play("AttackDown");
shakyCam = shakeTime;
Instantiate(aoeEffect, transform.position, Quaternion.identity);
audioSources[2].volume = PlayerPrefs.GetFloat(InGameMenu.effectVolKey);
audioSources[2].Play();
if (Random.Range(0, 5) == 0)
SFXManager.PlayerVoice();
return success;
}
success = base.AttemptMove (move);
if(success)
return true;
//else
if(move.isDirectional())
{
facing = move;
//find the destination tile
Vector2 moveDir = move.getDirection();
int destX = x + (int)moveDir.x;
int destY = y + (int)moveDir.y;
Entity target = GridManager.instance.getTarget(destX, destY);
if(target != null)
{
if(target.gameObject.tag == foeTag)
{
//a fightable enemy!
//deal it some damage.
target.takeDamage(blunderDamage);
animator.Play ("AttackLeft");
//Debug.Log("Player blunders into " + target.gameObject.name + ", dealing " + blunderDamage + " damage! " + target.health + " health remains.");
target.currentRed = 100;
return true;
}
}
return false;
}
else if(move == Move.Fight && combo > 0)
{
//Debug.Log("Ranged attempt triggered");
//try again with range.
//.........这里部分代码省略.........