Beispiel #1
0
    protected override void UpdateAnimDir(ref Vector3 moveDir)
    {
        // 추후에 움직임 애니메이션 생기거나하면 아래 함수 사용해서 구현
        NormalDir direction = Utility.VecToDir(moveDir);

        PlayAnimation(0, direction);
    }
Beispiel #2
0
 public void Block()
 {
     if (IsCanDoAction())
     {
         NormalDir direction = Utility.VecToDir(_thisObject.MoveDirection);
         PlayAnimation(0, direction);
         LockObject();
     }
 }
Beispiel #3
0
    public override void DoImpactMotion()
    {
        NormalDir direction = Utility.VecToDir(_thisObject.MoveDirection);

        int index = _animInfos.GetIndex(_currentAttackIndex, direction);

        if (index != -1)
        {
            CustomAnimController.StartImpactMotion(index, ActionAnimTime, this);
        }
    }
Beispiel #4
0
        private void CalculateCorner(NetSegment segment)
        {
            var cornerAngle = (IsStartSide ? segment.m_cornerAngleStart : segment.m_cornerAngleEnd) / 255f * 360f;

            if (IsLaneInvert)
            {
                cornerAngle = cornerAngle >= 180 ? cornerAngle - 180 : cornerAngle + 180;
            }
            CornerAngle = cornerAngle * Mathf.Deg2Rad;
            CornerDir   = DriveLanes.Length <= 1 ? CornerAngle.Direction() : (DriveLanes.Last().NetLane.CalculatePosition(T) - DriveLanes.First().NetLane.CalculatePosition(T)).normalized;
            NormalDir   = (DriveLanes.Any() ? DriveLanes.Aggregate(Vector3.zero, (v, l) => v + l.NetLane.CalculateDirection(T)).normalized : Vector3.zero) * (IsStartSide ? -1 : 1);
            NormalAngle = NormalDir.AbsoluteAngle();

            var angle = Vector3.Angle(NormalDir, CornerDir);

            CornerAndNormalAngle = (angle > 90 ? 180 - angle : angle) * Mathf.Deg2Rad;
        }
Beispiel #5
0
    protected virtual void UpdateAnimDir(ref Vector3 moveDir)
    {
        // 추후에 움직임 애니메이션 생기거나하면 아래 함수 사용해서 구현
        NormalDir direction = Utility.VecToDir(moveDir);

        PlayAnimation(0, direction);

        bool IsNegative = moveDir.x < 0.0f;

        if (IsNegative)
        {
            _thisObject.GetSpriteRenderer().flipX = true;
        }
        else
        {
            _thisObject.GetSpriteRenderer().flipX = false;
        }
    }
Beispiel #6
0
    protected override void UpdateAnimDir(ref Vector3 moveDir)
    {
        NormalDir direction = Utility.VecToDir(moveDir);

        if (isDoMoveAttack)
        {
            PlayAnimation(1, direction);
        }
        else
        {
            PlayAnimation(0, direction);
        }

        bool IsNegative = moveDir.x < 0.0f;

        if (IsNegative != transform.localScale.x < 0.0f)
        {
            transform.localScale = new Vector3(-transform.localScale.x, transform.localScale.y, transform.localScale.z);
        }
    }
Beispiel #7
0
        public void Update()
        {
            var segment   = GetSegment();
            var segmentId = GetSegmentId();

            Vector3 leftPos;
            Vector3 rightPos;
            Vector3 leftDir;
            Vector3 rightDir;

            if (IsStartSide)
            {
                segment.CalculateCorner(segmentId, true, true, true, out leftPos, out leftDir, out _);
                segment.CalculateCorner(segmentId, true, true, false, out rightPos, out rightDir, out _);
            }
            else
            {
                segment.CalculateCorner(segmentId, true, false, true, out leftPos, out leftDir, out _);
                segment.CalculateCorner(segmentId, true, false, false, out rightPos, out rightDir, out _);
            }

            CornerDir   = (rightPos - leftPos).normalized;
            CornerAngle = CornerDir.AbsoluteAngle();

            NormalDir   = NormalSign * (leftDir + rightDir).normalized;
            NormalAngle = NormalDir.AbsoluteAngle();

            var angle = Vector3.Angle(NormalDir, CornerDir);

            CornerAndNormalAngle = (angle > 90 ? 180 - angle : angle) * Mathf.Deg2Rad;
            TranformCoef         = Mathf.Sin(CornerAndNormalAngle);

            Position = (leftPos + rightPos) / 2f;

            RoadHalfWidth  = segment.Info.m_halfWidth - segment.Info.m_pavementWidth;
            FirstPointSide = GetPosition(-RoadHalfWidth);
            LastPointSide  = GetPosition(RoadHalfWidth);
            Line           = new StraightTrajectory(FirstPointSide, LastPointSide);
        }
Beispiel #8
0
    private bool AttackOnce()
    {
        int targetRow = (int)(_thisObject.Row + _thisObject.MoveDirection.x);
        int targetCol = (int)(_thisObject.Col + _thisObject.MoveDirection.y);

        NormalDir direction = Utility.VecToDir(_thisObject.MoveDirection);

        PlayAnimation(_currentAttackIndex, direction);
        Invoke("EnableTriggerAttack", 0.05f);
        Invoke("OnEnableSkipAnimation", EnableContinueAttackTime);

        bool IsNegative = _thisObject.MoveDirection.x < 0.0f;

        if (IsNegative)
        {
            _thisObject.GetSpriteRenderer().flipX = true;
        }
        else
        {
            _thisObject.GetSpriteRenderer().flipX = false;
        }
        return(true);
    }
Beispiel #9
0
    public void Idle()
    {
        NormalDir direction = Utility.VecToDir(_thisObject.MoveDirection);

        PlayAnimation(0, direction);
    }
Beispiel #10
0
    public virtual void DoImpactMotion()
    {
        NormalDir direction = Utility.VecToDir(_thisObject.MoveDirection);

        CustomAnimController.StartImpactMotion(_animInfos.GetIndex(0, direction), ActionAnimTime, this);
    }