Esempio n. 1
0
    /// <summary>
    /// 根据自身和目标之间的位置获取8方向之一。
    /// </summary>
    /// <param name="targeter"></param>
    /// <returns></returns>
    public EntityDirection GetDir8FromTargeter(TileEntity targeter)
    {
        var direction  = (targeter.GetCurrentPositionCenter() - GetCurrentPositionCenter()).normalized;
        var logicAngle = MathUtil2D.GetAngleFromVector(direction);

        return(GetDir8FromLogicAngle(logicAngle));
    }
Esempio n. 2
0
    protected override void DoActionIdle()
    {
        //m_tempTargeters = null;
        //Entity.State = EntityStateType.Idle;
        //m_timePassed = BattleRandom.Range(3f, 10f);

        AuxRecycleAllBulletLoopEffect();

        m_tempTargeters = null;
        Entity.State    = EntityStateType.Idle;
        m_timePassed    = BattleRandom.Range(0.5f, 1.5f);

#if UNITY_EDITOR
        BattleManager.logWaitTime.Add(GameRecord.Frame + ":timePassed:" + m_timePassed);
#endif  //  UNITY_EDITOR

        if (Entity.AimTarget)
        {
            //  背向地图中央
            var center = new Vector2(Constants.WIDTH / 2, Constants.HEIGHT / 2);
            var dir    = Entity.GetCurrentPositionCenter() - center;
            var angle  = MathUtil2D.GetAngleFromVector(IsoHelper.TileDirectionToScreenDirection(dir));

            Entity.PlayAnimationAtScreenAngle(AnimationNames.Stand, BattleRandom.Range(angle - 45, angle + 45));
        }
        else
        {
            Entity.PlayAnimation(AnimationNames.Stand);
        }
    }
Esempio n. 3
0
 public void PlayAnimationFaceToTile(string animationTypeName, TilePoint target, float fps = 0.0f)
 {
     view.PlayAnimation(animationNamePrefix + animationTypeName, GetDir5AndMirrorFlagFromDir8(GetDir8FromScreenAngle(MathUtil2D.GetAngleFromVector(IsoHelper.TileDirectionToScreenDirection(new Vector2(target.x - tilePos.x, target.y - tilePos.y))))), fps);
 }