Esempio n. 1
0
        public ArrowBullet(Transform Trans, ArrowBulletDescriptor Desc)
            : base(Trans, BulletType.Arrow, Desc.BaseBulletDesc)
        {
            StartPos_ = Desc.BaseBulletDesc.Position;
            EndPos_   = Desc.TargetPos;

            var MaxY       = Mathf.Max(StartPos_.y, EndPos_.y);
            var DisX       = Mathf.Abs(StartPos_.x - EndPos_.x);
            var ControlPos = new Vector2((StartPos_.x + EndPos_.x) / 2, MaxY + DisX / 2);

            BezierCurve_ = BezierCurveFactory.CreateBezierCurve(StartPos_, ControlPos, EndPos_);
            BezierTime_  = DisX / Mathf.Max(Desc.Speed, 1);
            CurrentTime_ = 0;

            StayTime_  = 1.0f;
            IsStaying_ = false;

            GetComponent <SpriteRenderer>().color = Desc.ArrowColor;

            var NextPos = BezierCurve_.Lerp(0.01f);

            SetRotationWithNextPos(NextPos);

            //AudioManager.PlaySound("audio/tf_arrow_bul.mp3");
        }
Esempio n. 2
0
        public static ArrowBullet AddArrowBullet(ArrowBulletDescriptor Desc)
        {
            var Obj = CreateBullet(BulletType.Arrow, Desc.BaseBulletDesc.Position);

            var Entity = new ArrowBullet(Obj.transform, Desc);

            BulletList_.Add(Entity);

            return(Entity);
        }