Example #1
0
        // 当前攻击力: 最大攻击力-被敌方吸收的攻击力
        // 若为空格,返回-1
        public int GetATAt(Hex coord)
        {
            MiroModelV1 model = _GridCtrl.GetMiroModelAt(coord);

            if (model == null)
            {
                return(-1);
            }

            int AT =
                model.GetAT();

            return(AT);
        }
Example #2
0
 // Update is called once per frame
 void Update()
 {
     if (_ToAbsorb)
     {
         MiroModelV1 model = CellObjCtrlUtils.GetMiroModelFromCell(_ToAbsorbCtrl);
         int         at    = model.GetAT();
         //print ("at:" + at);
         if (at != _AT)
         {
             ConfigBackToBackNb();
             _ToAbsorb = false;
         }
     }
 }
Example #3
0
        // Update is called once per frame
        void Update()
        {
            bool bA2B, bB2A;

            // get comps
            CellObjCtrl ctrlA =
                _TwoLink._A.GetComponent <CellObjCtrl> ();
            MiroModelV1 modelA =
                GetModelFromCellObj(_TwoLink._A);
            MiroV1ModelSetting modelSettingA = null;

            if (modelA != null)
            {
                modelSettingA =
                    modelA.GetComponent <MiroV1ModelSetting> ();
            }

            MiroModelV1 modelB =
                GetModelFromCellObj(_TwoLink._B);
            CellObjCtrl ctrlB =
                _TwoLink._B.GetComponent <CellObjCtrl> ();
            MiroV1ModelSetting modelSettingB = null;

            if (modelB != null)
            {
                modelSettingB =
                    modelB.GetComponent <MiroV1ModelSetting> ();
            }

            // check direction
            bA2B = IsXPointToY(ctrlA, ctrlB);
            bB2A = IsXPointToY(ctrlB, ctrlA);
            bool bBias = bA2B && bB2A;

            // compute at
            float dt  = Time.deltaTime;
            int   ata = 0;

            if (modelA != null)
            {
                ata = bA2B ? modelA.GetAT() : 0;
            }
            _ATAF = Mathf.Lerp(_ATAF, ata, dt * _LerpSpd);
            int atb = 0;

            if (modelB != null)
            {
                atb = bB2A? modelB.GetAT():0;
            }
            float lerpT = dt * _LerpSpd;

            _ATBF = Mathf.Lerp(_ATBF, atb, lerpT);

            // get Width
            float wdA = _WdOnAT.Evaluate(_ATAF) * _WdMult;
            float wdB = _WdOnAT.Evaluate(_ATBF) * _WdMult;

            if (!bA2B)
            {
                wdA = 0.0f;
            }
            if (!bB2A)
            {
                wdB = 0.0f;
            }
            _WdA = Mathf.Lerp(_WdA, wdA, lerpT);
            _WdB = Mathf.Lerp(_WdB, wdB, lerpT);

            // config LR
            Transform tfa, tfb;

            tfa = _TwoLink._A.transform;
            tfb = _TwoLink._B.transform;

            ConfigLR(_LRAB, tfa, tfb, modelSettingA, _ATAF, _WdA, bBias);
            ConfigLR(_LRBA, tfa, tfb, modelSettingB, _ATBF, -_WdB, bBias);
        }