Exemplo n.º 1
0
    void SetMode(string modeName)
    {
        if (objectInfo.draw)
        {
            int newMode = System.Array.IndexOf(COF.ModeNames[2], modeName);
            if (newMode == -1 || !objectInfo.mode[newMode])
            {
                Debug.LogWarning("Failed to set mode '" + modeName + "' of object " + name);
                return;
            }

            if (objectInfo.hasCollision[mode])
            {
                CollisionMap.SetPassable(Iso.Snap(iso.pos), objectInfo.sizeX, objectInfo.sizeY, true, gameObject);
            }

            mode = newMode;

            var cof = COF.Load(@"data\global\objects", objectInfo.token, "HTH", modeName);
            animator.shadow = objectInfo.blocksLight[mode];
            animator.cof    = cof;
            animator.loop   = objectInfo.cycleAnim[mode];
            animator.SetFrameRange(objectInfo.start[mode], objectInfo.frameCount[mode]);
            animator.frameDuration = objectInfo.frameDuration[mode];

            if (objectInfo.hasCollision[mode])
            {
                CollisionMap.SetPassable(Iso.Snap(iso.pos), objectInfo.sizeX, objectInfo.sizeY, false, gameObject);
            }
        }
    }
Exemplo n.º 2
0
        private void Update()
        {
            var info = _staticObject.info;
            var mode = _staticObject.Mode;

            if (!info.mode[mode.index])
            {
                _renderer.cof = null;
                return;
            }

            if (_renderer.cof == null || _renderer.cof.mode != mode.token)
            {
                var cof = COF.Load(@"data\global\objects", info.token, "HTH", mode.token);
                _renderer.shadow = info.blocksLight[mode.index];
                _renderer.cof    = cof;
            }

            int frame = (int)(_staticObject.AnimationTime * info.frameCount[mode.index] / _staticObject.AnimationDuration);

            frame           = Mathf.Min(frame, info.frameCount[mode.index]);
            frame           = Mathf.Max(frame, 0);
            frame          += info.start[mode.index];
            _renderer.frame = frame;
        }
Exemplo n.º 3
0
        private void Update()
        {
            var    mode        = _unit.Mode;
            string weaponClass = _unit.weaponClass;

            if (mode == "DT" || mode == "DD")
            {
                weaponClass = "HTH";
            }

            _renderer.cof       = COF.Load(_unit.basePath, _unit.token, weaponClass, mode);
            _renderer.direction = _unit.DirectionIndex;
            _renderer.frame     = _unit.AnimationFrame;
        }
Exemplo n.º 4
0
        void UpdateAnimation()
        {
            string mode        = Mode;
            string weaponClass = this.weaponClass;

            _animator.speed = 1.0f;
            _animator.loop  = true;
            if (mode == "DT" || mode == "DD")
            {
                weaponClass    = "HTH";
                _animator.loop = false;
            }

            _animator.cof       = COF.Load(basePath, token, weaponClass, mode);
            _animator.direction = _directionIndex;
        }
Exemplo n.º 5
0
    void UpdateAnimation()
    {
        string mode;
        string weaponClass = this.weaponClass;

        animator.speed = 1.0f;
        animator.loop  = true;
        if (ressurecting && monStat != null)
        {
            mode = monStat.ext.resurrectMode;
        }
        else if (dying)
        {
            mode          = "DT";
            weaponClass   = "HTH";
            animator.loop = false;
        }
        else if (dead)
        {
            mode          = "DD";
            weaponClass   = "HTH";
            animator.loop = false;
        }
        else if (takingDamage)
        {
            mode = "GH";
        }
        else if (hasMoved)
        {
            mode = run ? "RN" : "WL";
        }
        else if (usingSkill)
        {
            mode = skillInfo.anim;
        }
        else
        {
            mode = "NU";
        }

        animator.cof       = COF.Load(basePath, token, weaponClass, mode);
        animator.direction = directionIndex;
    }
Exemplo n.º 6
0
        static COF GetCof(CharStatsInfo info, string mode)
        {
            var basePath = @"data\global\chars";

            return(COF.Load(basePath, info.token, info.baseWClass, mode));
        }