Beispiel #1
0
 public virtual void InitSkill(MotionBase motionBase, SkillBaseRecord skillBase)
 {
     _MotionBase     = motionBase;
     _SkillRecord    = skillBase;
     _LastSkillRound = BattleField.Instance._BattleRound - 1;
     _SkillCD        = _SkillRecord.PreCD;
 }
        private void button_add_ok_Click(object sender, EventArgs e)
        {
            try
            {
                m_listAxisPosValue.Clear();
                IMotion imotion = MotionBase.GetInstanceInterface();
                if (imotion != null)
                {
                    for (int i = 0; i < imotion.GetAxisCount(); i++)
                    {
                        TextBox textbox = (TextBox)flowLayoutPanel1.Controls.Find("textBox_" + i, true)[0];
                        m_listAxisPosValue.Add(textbox.Text);
                    }

                    DialogResult = System.Windows.Forms.DialogResult.OK;
                }

                Close();
            }
            catch (Exception E)
            {
                LogFile.LogExceptionErr(E.ToString());
                MessageBox.Show(E.Message);
            }
        }
Beispiel #3
0
    IEnumerator StartMotion(MotionBase method, float factor, float accel, float decel, float delay, params float[] target)
    {
        isPaused = false;
        isMoving = true;
        float[] origin   = new float[Mathf.Min(target.Length, motionNumbers.Length)];
        float[] distance = new float[origin.Length];
        for (int i = 0; i < origin.Length; i++)
        {
            origin[i]   = motionNumbers[i];
            distance[i] = Mathf.Abs(origin[i] - target[i]);
        }
        float dist = Mathf.Max(distance);

        GetMotionParatmers(method, factor, accel, decel, dist);
        if (dist > error && factor >= 0 && accel >= 0 && decel >= 0)
        {
            while (isMoving && rate != 1)
            {
                if (!isPaused)
                {
                    Rate();
                    for (int i = 0; i < origin.Length; i++)
                    {
                        motionNumbers[i] = Mathf.Lerp(origin[i], target[i], rate);
                    }
                }
                yield return(0);
            }
        }
        for (int i = 0; i < origin.Length; i++)
        {
            motionNumbers[i] = target[i];
        }
        isMoving = false;
    }
Beispiel #4
0
    public DamageResult CastDamage(MotionBase monster)
    {
        DamageResult result = new DamageResult();

        result._TargetMotion = this;
        result._BeforeHP     = _HP;

        int damage = 0;

        if (monster._MonsterRecord != null)
        {
            var   elementRelation = BattleField.GetRoleDefRelation(monster._MonsterRecord.ElementType);
            float relation        = BattleField.GetRelationRate(elementRelation);

            damage = (int)(monster._Attack * relation);

            result._DamageType = DAMAGE_TYPE.Normal;
            if (relation > 1)
            {
                result._DamageType = DAMAGE_TYPE.Double;
            }
            else if (relation < 1)
            {
                result._DamageType = DAMAGE_TYPE.Half;
            }
        }

        result.DamageValue = damage;
        _HP -= damage;

        result._AfterHP = _HP;

        return(result);
    }
Beispiel #5
0
    public MotionBase GetMonsterMotion(string monsterID)
    {
        Debug.Log("GetMonsterMotion:" + monsterID);
        MotionBase motionBase = new MotionBase();

        motionBase.InitMonster(TableReader.MonsterBase.GetRecord(monsterID), _StageRecord.Level);
        return(motionBase);
    }
Beispiel #6
0
    public override void UseSkill(MotionBase targetMotion, ref DamageResult damageResult)
    {
        base.UseSkill(targetMotion, ref damageResult);

        int damage = _MotionBase._Attack;

        targetMotion.CastDamage(_MotionBase);
        damageResult.DamageValue = damage;
    }
Beispiel #7
0
        static void Main()
        {
            MotionBase.ReadMotionINI(DefPath.MotionSetting);
            DIOBase.ReadIoINI(DefPath.MotionSetting);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new MainForm());
        }
Beispiel #8
0
    public void GetMotionParatmers(MotionBase method, float factor, float accel, float decel, float distance)
    {
        accV = 0;
        decV = 0;
        maxV = 0;
        accT = 0;
        decT = 0;
        maxT = 0;
        dt   = 0;
        ds   = 0;
        maxS = distance;
        rate = 0;
        if (factor <= 0 && accel <= 0 && decel <= 0)
        {
            maxT = 0;
        }
        else
        {
            switch (method)
            {
            case MotionBase.VELOCITY:
                accV = accel > 0 ? accel : 0;
                decV = decel > 0 ? decel : 0;
                maxV = factor > 0 ? factor : 0;
                accT = accV > 0 ? maxV / accV : 0;
                decT = decV > 0 ? maxV / decV : 0;
                avgT = maxV > 0 ? maxS / maxV - (accT + decT) * 0.5f : 0;
                if (avgT < 0)
                {
                    accT = accV > 0 ? decV > 0 ? Mathf.Sqrt(2 * decV * maxS / (accV * (accV + decV))) : Mathf.Sqrt(maxS / accV) : 0;
                    decT = decV > 0 ? accV > 0 ? Mathf.Sqrt(2 * accV * maxS / (decV * (accV + decV))) : Mathf.Sqrt(maxS / decV) : 0;
                    avgT = 0;
                    maxV = accT > 0 ? accV * accT : decV * decT;
                }
                break;

            case MotionBase.TIME:
                accT = accel > 0 ? accel : 0;
                decT = decel > 0 ? decel : 0;
                avgT = factor > 0 ? factor : 0;
                maxT = avgT + (accT + decT) * 0.5f;
                maxV = maxS / maxT;
                accV = accT > 0 ? maxV / accT : 0;
                decV = decT > 0 ? maxV / decT : 0;
                break;
            }
            maxT = accT + avgT + decT;
        }
        accS = 0.5f * maxV * accT;
        avgS = maxV * avgT;
        decS = 0.5f * maxV * decT;
        //Debug.Log("accV: " + accV + ", maxV: " + maxV + ", decV: " + decV);
        //Debug.Log("accT: " + accT + ", avgT: " + avgT + ", decT: " + decT + ", maxT: " + maxT);
        //Debug.Log("accS: " + accS + ", avgS: " + avgS + ", decS: " + decS + ", maxS: " + maxS);
        //Debug.Log("GetMotionParatmers: " + dt + ", " + maxT + " | " + ds + " , " + maxS + " | " + factor + " . " + accel + " . " + decel + " . " + distance);
    }
Beispiel #9
0
    public void InitMonsterInfo(MotionBase monster)
    {
        _Monster = monster;

        ResourceManager.Instance.SetImage(_MagicImg, CommonDefine.GetElementIcon(monster._MonsterRecord.ElementType));
        RefreshCD();

        _MaxHP = monster._MaxHP;
        RefreshHP((float)monster._HP);
    }
Beispiel #10
0
    public void Transformation(MotionBase mBase, float factor, float accel, float decel, Vector3 movement, Vector3 rotation, Vector3 scaling, Color fading, float canvasAlpha, State state, float delay)
    {
        switch (hideMethod)
        {
        case Hide.DISABLE: gameObject.SetActive(true); break;

        case Hide.RAYCAST: canvasGroup.blocksRaycasts = true; break;
        }
        StopAllCoroutines();
        StartCoroutine(StartTransition(mBase, factor, accel, decel, position + displacement + movement, eulerAngles + rotation, new Vector3(scale.x * scaling.x, scale.y * scaling.y, scale.z * scaling.z), fading, canvasAlpha, state, delay));
    }
Beispiel #11
0
    public override void UseSkill(MotionBase targetMotion, ref DamageResult damageResult)
    {
        base.UseSkill(targetMotion, ref damageResult);

        int damage = _MotionBase._Attack;

        //targetMotion.CastDamage(_MotionBase);
        //damageResult.DamageValue = damage;
        //RandomTrapInfo();
        damageResult._SkillBallsResult = SetPosTrap();
    }
    IEnumerator StartTranslating(MotionBase mBase, float factor, float accel, float decel, Vector3 position, Vector3 eulerAngles, Vector3 scale, float delay)
    {
        isPaused = false;
        isMoving = true;

        Vector3 originPos   = transform.position;
        Vector3 originAngle = transform.localEulerAngles;
        Vector3 originScale = transform.localScale;
        float   distance    = Vector3.Distance(originPos, position);
        float   angle3D     = ECCommons.Angle3D(originAngle, eulerAngles) * angularRatio;
        float   scale3D     = Vector3.Distance(originScale, scale) * scalingRatio;
        float   dist        = Mathf.Max(distance, angle3D, scale3D);

        GetMotionParatmers(mBase, factor, accel, decel, dist);
        if (dist > error && factor >= 0 && accel >= 0 && decel >= 0)
        {
            while (isMoving && rate != 1)
            {
                if (!isPaused)
                {
                    Rate();
                    transform.position         = Vector3.Lerp(originPos, position, rate);
                    transform.localEulerAngles = Vector3.Lerp(originAngle, eulerAngles, rate);
                    transform.localScale       = Vector3.Lerp(originScale, scale, rate);
                }
                yield return(0);
            }
        }
        switch (loop)
        {
        case Loop.RESTART:
            transform.position         = originPos;
            transform.localEulerAngles = originAngle;
            transform.localScale       = originScale;
            Transformation(Method.TO, mBase, factor, accel, decel, position, eulerAngles, scale, delay);
            break;

        case Loop.REVERSE:
            Transformation(Method.TO, mBase, factor, accel, decel, originPos, originAngle, originScale, delay);
            break;

        case Loop.CONTINUE:
            Transformation(Method.BY, mBase, factor, accel, decel, position, eulerAngles, scale, delay);
            break;

        default:
            transform.position         = position;
            transform.localEulerAngles = eulerAngles;
            transform.localScale       = scale;
            isMoving = false;
            break;
        }
    }
 public Order(Method method, MotionBase mBase, float factor, float accel, float decel, Vector3 position, Vector3 eulerAngles, Vector3 scale, float delay)
 {
     this.method      = method;
     this.mBase       = mBase;
     this.factor      = factor;
     this.accel       = accel;
     this.decel       = decel;
     this.position    = position;
     this.eulerAngles = eulerAngles;
     this.scale       = scale;
     this.delay       = delay;
 }
Beispiel #14
0
        public MotionSetting()
        {
            switch (MotionBase.GetKindOfMotion())
            {
            case MotionBase.KIND_MOTION.AJIN:
            {
                m_motion = MotionAjin.GetInstance();
            }
            break;
            }

            InitializeComponent();
        }
Beispiel #15
0
    public override void InitSkill(MotionBase motionBase, SkillBaseRecord skillBase)
    {
        base.InitSkill(motionBase, skillBase);

        _SameRate = GameDataValue.ConfigIntToFloat(skillBase.Param[0]);
        _BombRate = GameDataValue.ConfigIntToFloat(skillBase.Param[1]);
        _TrapType = (BallType)skillBase.Param[2];
        _FindPosNum.Clear();
        _FindPosNum.Add(skillBase.Param[3]);
        _FindPosNum.Add(skillBase.Param[4]);
        _FindPosNum.Add(skillBase.Param[5]);
        _FindPosNum.Add(skillBase.Param[6]);
    }
        private void AddMotionData_Load(object sender, EventArgs e)
        {
            IMotion imotion = MotionBase.GetInstanceInterface();

            if (imotion != null)
            {
                if (m_modeMotData == MotionDataMode.Add)
                {
                    Text = "AddMotionData";
                    button_add_ok.Text = "Add";
                }
                else if (m_modeMotData == MotionDataMode.Modify)
                {
                    Text = "ModifyMotionData";
                    button_add_ok.Text = "Modify";
                }

                int axisCnt = imotion.GetAxisCount();

                for (int i = 0; i < axisCnt; i++)
                {
                    comboBox_axis.Items.Add(i);

                    Label label = new Label();
                    label.Name     = "label_" + i;
                    label.Text     = "Axis " + i + " : ";
                    label.AutoSize = true;
                    flowLayoutPanel1.Controls.Add(label);

                    TextBox textbox = new TextBox();
                    textbox.Name = "textBox_" + i;
                    if (m_modeMotData == MotionDataMode.Modify && m_listAxisPosValue.Count > 0)
                    {
                        textbox.Text = m_listAxisPosValue[i];
                    }
                    else
                    {
                        textbox.Text = "";
                    }
                    flowLayoutPanel1.Controls.Add(textbox);
                }

                if (comboBox_axis.Items.Count > 0)
                {
                    comboBox_axis.SelectedIndex = 0;
                }
            }
        }
Beispiel #17
0
 public void RefreshMonsterInfo(MotionBase monster)
 {
     if (_MonsterShowDict.ContainsKey(monster))
     {
         if (monster.IsDied)
         {
             _MonsterShowDict[monster]._MonsterModel.gameObject.SetActive(false);
             _MonsterShowDict[monster]._AppearAnim.gameObject.SetActive(false);
             _MonsterShowDict[monster]._UIHPItem.gameObject.SetActive(false);
         }
         else
         {
             _MonsterShowDict[monster]._UIHPItem.InitMonsterInfo(monster);
         }
     }
 }
Beispiel #18
0
    public static void RefreshMonster(MotionBase monster)
    {
        var instance = GameCore.Instance.UIManager.GetUIInstance <UIFightBattleField>(UIConfig.UIFightBattleField);

        if (instance == null)
        {
            return;
        }

        if (!instance.isActiveAndEnabled)
        {
            return;
        }

        instance.RefreshMonsterInfo(monster);
    }
 private void tmDisplay_Tick(object sender, EventArgs e)
 {
     try
     {
         IMotion imotion = MotionBase.GetInstanceInterface();
         if (imotion != null)
         {
             int    index  = comboBox_axis.SelectedIndex;
             double actPos = imotion.AxisGetActualPosition(index);
             textBox_pos.Text = String.Format("{0}", actPos);
         }
     }
     catch (Exception E)
     {
         LogFile.LogExceptionErr(E.ToString());
     }
 }
Beispiel #20
0
    private void InitRole()
    {
        _RoleMotion = new MotionBase();

        var attr = WeaponDataPack.Instance.SelectedWeaponItem.GetCurLevelAttrs();
        //_RoleMotion._Attack = (int)attr[0];
        //_RoleMotion._MaxHP = (int)attr[1];

        int stageLevel = int.Parse(_StageRecord.Id);
        int testLevel  = stageLevel;
        int attrValue  = Mathf.Max(testLevel, 1);

        _RoleMotion._Attack = GameDataValue.GetLevelAtk(attrValue);
        _RoleMotion._MaxHP  = GameDataValue.GetLevelHP(attrValue);

        _RoleMotion._HP          = _RoleMotion._MaxHP;
        _RoleMotion._ElementType = ELEMENT_TYPE.NONE;
    }
        private void motionToolStripMenuItem_Click(object sender, EventArgs e)
        {
            if (MotionBase.GetInstanceInterface() == null)
            {
                MessageBox.Show("Motion이 존재하지 않습니다.");
                return;
            }

            if (m_motionCtrlAjin == null)
            {
                m_motionCtrlAjin = new MotionControlForm();
            }

            m_motionCtrlAjin.Show();
            m_motionCtrlAjin.Focus();

            m_motionCtrlAjin.Location = new Point(this.Location.X + this.Size.Width, this.Location.Y);
        }
Beispiel #22
0
        public AddSeqMotion()
        {
            InitializeComponent();

            m_motion = MotionBase.GetInstanceInterface();
            if (m_motion != null)
            {
                int nAxisCnt = m_motion.GetAxisCount();
                for (int i = 0; i < nAxisCnt; i++)
                {
                    comboBox_index.Items.Add(m_motion.GetAxisDevName(i));
                }

                if (nAxisCnt > 0)
                {
                    comboBox_index.SelectedIndex = 0;
                }
            }
        }
Beispiel #23
0
 private void MotionSetting_Load(object sender, EventArgs e)
 {
     if (m_motion != null)
     {
         switch (MotionBase.GetKindOfMotion())
         {
         case MotionBase.KIND_MOTION.AJIN:
         {
             m_motSettingAjin = new MotionSettingAjin(m_motion);
             Controls.Add(m_motSettingAjin);
             Size s = new Size(m_motSettingAjin.Width + 40, m_motSettingAjin.Height + 40);
             Size = s;
         }
         break;
         }
     }
     else
     {
         Close();
     }
 }
        private void button_current_set_Click(object sender, EventArgs e)
        {
            try
            {
                IMotion imotion = MotionBase.GetInstanceInterface();
                if (imotion != null)
                {
                    if (comboBox_axis.Items.Count > 0)
                    {
                        int index = comboBox_axis.SelectedIndex;

                        TextBox textbox = (TextBox)flowLayoutPanel1.Controls.Find("textBox_" + index, true)[0];
                        textbox.Text = String.Format("{0}", imotion.AxisGetActualPosition(index));
                    }
                }
            }
            catch (Exception E)
            {
                LogFile.LogExceptionErr(E.ToString());
                MessageBox.Show(E.Message);
            }
        }
    protected override void OnActionEnter()
    {
        mTargetMotion = currentTarget.GetComponent<MotionBase>();

        switch(type) {
        case ActionType.Disperse:
            break;

        case ActionType.Attack:
            if(flockUnit != null) {
                flockUnit.moveTarget = currentTarget.transform;
            }

            if(gameObject.activeInHierarchy)
                StartCoroutine("ReturnToLeader");

            //no need to constantly check
            if(attackSensor != null) {
                attackSensor.enabled = false;

                if(flockUnit != null) {
                    flockUnit.minMoveTargetDistance = attackSensor.minRange;
                }
            }

            if(spellSensor != null) {
                spellSensor.enabled = false;
            }
            break;

        case ActionType.Retreat:
        case ActionType.Follow:
            if(flockUnit != null) {
                flockUnit.moveTarget = currentTarget.target;
            }

            if(gameObject.activeInHierarchy)
                StartCoroutine("FollowStop");
            break;

        default:
            if(flockUnit != null) {
                flockUnit.moveTarget = currentTarget.target;
            }
            break;
        }
    }
 public void Scale(MotionBase mBase, float factor, float accel, float decel, float magnification)
 {
     Scale(mBase, factor, accel, decel, Vector3.one * magnification, 0);
 }
 public void Rotate(MotionBase mBase, float factor, float accel, float decel, Vector3 degree)
 {
     Rotate(mBase, factor, accel, decel, degree, 0);
 }
    protected override void OnActionFinish()
    {
        if(flockUnit != null) {
            flockUnit.Stop();
        }

        mTargetMotion = null;

        if(attackSensor != null) { //renabled after attack
            attackSensor.enabled = true;
        }

        StopCoroutine("FollowStop");
        StopCoroutine("ReturnToLeader");

        //if no default, see if we have a waypoint to follow
    }
Beispiel #29
0
 public void MotionDie(MotionBase motion)
 {
     _DiedMonster.Add(motion);
     _Monster.Remove(motion);
 }
 public void Rotate(MotionBase mBase, float factor, float accel, float decel, Vector3 degree, float delay)
 {
     Transformation(Method.BY, mBase, factor, accel, decel, Vector3.zero, degree, Vector3.one, delay);
 }
 public void Move(MotionBase mBase, float factor, float accel, float decel, Vector3 distance)
 {
     Move(mBase, factor, accel, decel, distance, 0);
 }
 public void Scale(MotionBase mBase, float factor, float accel, float decel, Vector3 magnification, float delay)
 {
     Transformation(Method.BY, mBase, factor, accel, decel, Vector3.zero, Vector3.zero, magnification, delay);
 }
    protected override void OnActionFinish()
    {
        if(flockUnit != null) {
            flockUnit.Stop();
        }

        mTargetMotion = null;

        if(attackSensor != null) { //renabled after attack
            attackSensor.enabled = true;
        }

        if(spellSensor != null) {
            spellSensor.enabled = true;
        }

        StopCoroutine("FollowStop");
        StopCoroutine("ReturnToLeader");
    }