Beispiel #1
0
    //public _Armor3	armor;

    //public float	outerArmor;

    //public float	innerArmor;



    //public _Wapon3	wapon;



    public override void init(_Action3Enemy action)
    {
        var act = action as AntAction3;        //(AntAction3)action;

        if (act)
        {
            act.wriggler.tfHead.localScale = headScales[(int)bodyType];

            act.wriggler.tfWeist.localScale = hipScales[(int)bodyType];
        }

        action.tf.localScale = Vector3.one * sizeScale;
    }
Beispiel #2
0
    void addphys(_Action3Enemy act)      // テスト
    {
        // 剛体を各コライダに作ると高速化せず、逆に多少遅くなるみたい。
        var cols = act.tfBody.GetComponentsInChildren <Collider>()
                   .Where(x => x.gameObject.layer == UserLayer._enemyDetail)
                   .Where(x => x.gameObject.GetComponent <Rigidbody>() == null);

        foreach (var col in cols)
        {
            var rb = col.gameObject.AddComponent <Rigidbody>();
            rb.isKinematic = true;
        }
    }
Beispiel #3
0
        public void init(_Action3Enemy act)
        {
            scaleRate = Mathf.Max(act.tf.localScale.y, act.tf.localScale.z);

            scaleRateR = 1.0f / scaleRate;


            var bodyObject = act.tfBody.findWithLayer(UserLayer._enemyEnvelope);                                       //

            bodyRadius = bodyObject != null?bodyObject.GetComponent <SphereCollider>().radius *scaleRate : moveRadius; //


            groundHookReach = bodyRadius * act.def.groundHookReachRate;
        }
Beispiel #4
0
        float                   limitTime; // どうしてもたどり着けない場合のための時間制限など



        // 移動先計算 ---------------------

        public bool routine(_Action3Enemy self, ref TargetFinder.Target target)
        {
            if (!isGoalOrLimit(ref self.figure, self.rb.position))
            {
                return(false);
            }

            if (target.isExists)
            {
                setTargetPoint(self, ref target);
            }
            else
            {
                setTargetPoint(self);
            }

            return(true);
        }
Beispiel #5
0
        public void update(_Action3Enemy act)
        {
            var rotBody = act.rb.rotation;


            if (turn.enabled || bend.enabled)
            {
                var rotWriggle = Quaternion.Inverse(preRotBody) * rotBody;

                var angles = rotWriggle.eulerAngles;


                if (turn.enabled)
                {
                    var turnAngle = (angles.y > 180.0f ? angles.y - 360.0f : angles.y) * GM.t.deltaR;

                    turnAngle = Mathf.Clamp(turnAngle, -60.0f, 60.0f);

                    var turnTime = turnAngle * (-1.0f / 60.0f) + 1.0f + 1.0f;

                    turn.time = Mathf.Lerp(turn.time, turnTime, GM.t.delta * act.move.speedRate01 * 3.0f);
                }


                if (bend.enabled)
                {
                    var bendAngle = (angles.x > 180.0f ? angles.x - 360.0f : angles.x) * GM.t.deltaR;

                    //	bendAngle = Mathf.Clamp( bendAngle, -90.0f, 90.0f );

                    var bendTime = bendAngle * (-1.0f / 90.0f) + 2.0f + 1.0f;

                    bend.time = Mathf.Lerp(bend.time, bendTime, GM.t.delta * act.move.speedRate01 * 3.0f);
                }
            }


            preRotBody = rotBody;
        }
Beispiel #6
0
 public abstract void init(_Action3Enemy act);
Beispiel #7
0
 /// <summary>
 /// 初期化時以外変化しない速度値を設定する。
 /// </summary>
 public void initBaseSpeed(_Action3Enemy act)
 {
     baseSpeed = act.classBasedSpeed * act.def.quickness * act.figure.scaleRate;
 }
Beispiel #8
0
        public void setTargetPoint(_Action3Enemy self, ref TargetFinder.Target target)
        {
            targetPoint = target.imaginaryPosition;            //self.rb.position + ( target.imaginaryPosition - self.rb.position ) * 0.5f;

            setTimer(Random.Range(0.5f, 3.0f));
        }
Beispiel #9
0
        public ForwawrdAndUnderRaycaster(ref PostureState posture, ref FigureInfo figure, _Action3Enemy act)
        {
            r = new UnderRaycaster(ref posture, ref figure, act);


            movedist = act.stance.moveSpeed * GM.t.delta;


            moveRadius = figure.moveRadius;


            forward = posture.rot * Vector3.forward;

            forwardOrigin = posture.isGotFoothold ? r.bodypos : r.bodypos - forward;
        }
Beispiel #10
0
 /// <summary>
 /// アニメーションスピードを計算する。
 /// </summary>
 public float getMotionSpeed(_Action3Enemy act, float currentActionSpeed, float movableRate)
 {
     return(getMotionSpeed(act) * currentActionSpeed * movableRate);
 }
Beispiel #11
0
 /// <summary>
 /// アニメーションスピードを計算する。quickness * scaleRateR を計算する。
 /// </summary>
 public float getMotionSpeed(_Action3Enemy act)
 {
     return(act.def.quickness * act.figure.scaleRateR);
 }
Beispiel #12
0
 public void init(_Action3Enemy act)
 {
     preRotBody = act.rb.rotation;
 }