exSprite.HFlip C# (CSharp) Method

HFlip() public method

public HFlip ( ) : void
return void
    public void HFlip()
    {
        scale_.x = -scale_.x; updateFlags |= UpdateFlags.Vertex;
    }

Usage Example

Example #1
0
    public void InitArmyInfo(ArmyInfo ai)
    {
        armyInfo          = ai;
        armyInfo.armyCtrl = GetComponent <ArmyController>();

        SetArmyKingFlag();

        if (armyInfo.cityTo != -1)
        {
            if (pathfinding == null)
            {
                pathfinding = GameObject.FindWithTag("Pathfinding").GetComponent <MyPathfinding>();
            }
            SetRoute(pathfinding.GetRoute(armyInfo.pos, armyInfo.cityTo));
        }

        state    = (ArmyState)armyInfo.state;
        timeTick = armyInfo.timeTick;

        if (state == ArmyState.Garrison)
        {
            exSprite          moveSprite = GetComponent <exSprite>();
            exSpriteAnimation moveAnim   = GetComponent <exSpriteAnimation>();
            moveAnim.Stop();

            int frame = armyInfo.direction;
            if (frame == -1)
            {
                frame = 0;
            }
            moveAnim.SetFrame("ArmyGarrison", frame);

            Vector3 pos = flagPos[3 + frame];
            if (!armyInfo.isFlipped)
            {
                pos.x = -pos.x;
            }
            else
            {
                isHFlipped = true;
                moveSprite.HFlip();

                exSprite    flagSprite = flagCtrl.GetComponent <exSprite>();
                BoxCollider flagCol    = flagCtrl.GetComponent <BoxCollider>();
                flagSprite.HFlip();
                flagCol.center = new Vector3(-flagCol.center.x, flagCol.center.y, flagCol.center.z);
            }

            flagCtrl.localPosition = pos;
        }
        else
        {
            CalcDirection();
        }
    }
All Usage Examples Of exSprite::HFlip