// Token: 0x060032D1 RID: 13009 RVA: 0x000E4C04 File Offset: 0x000E2E04
        internal static string AlignmentToString(HAlign a, DirState ds)
        {
            switch (a)
            {
            case HAlign.AlignLeft:
                if (ds == DirState.DirRTL)
                {
                    return("Right");
                }
                return("Left");

            case HAlign.AlignRight:
                if (ds == DirState.DirRTL)
                {
                    return("Left");
                }
                return("Right");

            case HAlign.AlignCenter:
                return("Center");

            case HAlign.AlignJustify:
                return("Justify");
            }
            return("");
        }
Ejemplo n.º 2
0
    //void Update()
    //{
    //    //pos1 = obj.transform.position;
    //    //DirState testState;
    //    //testState=CalculateBulletDir(pos1);
    //}
    public DirState CalculateBulletDir(Vector3 bulletPos)
    {
        posPlayer = PlayerControler.transform.position;
        bulletPos = new Vector3(bulletPos.x, posPlayer.y, bulletPos.z);
        vectorDis = bulletPos - posPlayer;
        angle     = CalculateAngle(vectorDis);
        Cross     = CalculateCross(vectorDis);
        DirState BulletDirectionState = CalculateDirection(angle, Cross);

        return(BulletDirectionState);
    }
Ejemplo n.º 3
0
    // Start is called before the first frame update
    void Start()
    {
        rb                     = GetComponent <Rigidbody2D>();
        audio_Jump             = gameObject.AddComponent <AudioSource>();
        sound_Jump             = Resources.Load <AudioClip>("Audio/Player/sound_Jump");
        audio_Jump.clip        = sound_Jump;
        audio_Jump.playOnAwake = false;

        cur_state      = FixedState.unfix;
        cur_dir_state  = DirState.front;
        extra_strength = 0;
    }
Ejemplo n.º 4
0
        public Player()
        {
            texInfo = new TextureInfo("/Application/textures/spacebro2.png");
            sprite  = new SpriteUV(texInfo);

            sprite.Quad.S   = texInfo.TextureSizef;
            sprite.Position = new Vector2(0, 0);

            dirState  = DirState.Still;
            actState  = ActState.Ground;
            walkSpeed = 2.0f;
        }
Ejemplo n.º 5
0
 void Transition()
 {
     transform.localScale = new Vector3(transform.localScale.x * -1,
                                        transform.localScale.y, transform.localScale.z);
     if (cur_dir_state == DirState.front)
     {
         cur_dir_state = DirState.reverse;
     }
     else
     {
         cur_dir_state = DirState.front;
     }
 }
Ejemplo n.º 6
0
        private void GetInput()
        {
            dirState = DirState.Still;

            if (InputHandler.KeyPressed(InputHandler.Key.Right))
            {
                dirState = DirState.Right;
            }

            if (InputHandler.KeyPressed(InputHandler.Key.Left))
            {
                dirState = DirState.Left;
            }
        }
Ejemplo n.º 7
0
    DirState CalculateDirection(float currentAngle, Vector3 currentCross)
    {
        DirState currentDir = DirState.North;

        if (0 <= currentAngle && currentAngle < 22.5)
        {
            currentDir = DirState.North;
        }
        if (22.5 <= currentAngle && currentAngle < 67.5)
        {
            if (currentCross.y > 0)
            {
                currentDir = DirState.NorthEast;
            }
            if (currentCross.y < 0)
            {
                currentDir = DirState.NorthWest;
            }
        }
        if (67.5 <= currentAngle && currentAngle < 112.5)
        {
            if (currentCross.y > 0)
            {
                currentDir = DirState.East;
            }
            if (currentCross.y < 0)
            {
                currentDir = DirState.West;
            }
        }
        if (112.5 <= currentAngle && currentAngle < 157.5)
        {
            if (currentCross.y > 0)
            {
                currentDir = DirState.SouthEast;
            }
            if (currentCross.y < 0)
            {
                currentDir = DirState.SouthWest;
            }
        }

        if (157.5 <= currentAngle && currentAngle < 180)
        {
            currentDir = DirState.South;
        }
        return(currentDir);
    }
Ejemplo n.º 8
0
 public void weakEnemyMovement()
 {
     if (i > 100)
     {
         dirState = DirState.Left;
         if (i == 200)
         {
             i = 0;
         }
     }
     else
     {
         dirState = DirState.Right;
     }
     i++;
 }
Ejemplo n.º 9
0
    private void OnTriggerStay2D(Collider2D collision)
    {
        if (collision.gameObject.tag.Contains("Player"))
        {
            Player_1 p1             = collision.gameObject.GetComponent <Player_1>();
            float    other_strength = p1.strength;

            DirState    other_dir_state = p1.cur_dir_state;
            Rigidbody2D other_rb        = collision.gameObject.GetComponent <Rigidbody2D>();

            if (other_dir_state != cur_dir_state)
            {
                rb.AddForce(-1 * transform.position * other_strength);
                other_rb.AddForce(transform.position * strength);
            }
            else if (other_dir_state == cur_dir_state)
            {
                rb.AddForce(transform.position * other_strength);
                other_rb.AddForce(-1 * transform.position * strength);
            }
        }
    }
Ejemplo n.º 10
0
 public void strongEnemyMovement(bool second)
 {
     if (second == false)
     {
         if (i > 50)
         {
             dirState        = DirState.Left;
             sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y - 5);
             if (i == 100)
             {
                 i = 0;
             }
         }
         else
         {
             dirState        = DirState.Right;
             sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y + 5);
         }
     }
     else
     {
         if (i > 50)
         {
             dirState        = DirState.Right;
             sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y - 5);
             if (i == 100)
             {
                 i = 0;
             }
         }
         else
         {
             dirState        = DirState.Left;
             sprite.Position = new Vector2(sprite.Position.X, sprite.Position.Y + 5);
         }
     }
     i++;
 }
Ejemplo n.º 11
0
        // Token: 0x060034AE RID: 13486 RVA: 0x000EA894 File Offset: 0x000E8A94
        private void PreCoalesceList(DocumentNode dn)
        {
            int      index    = dn.Index;
            bool     flag     = false;
            DirState dirState = DirState.DirDefault;
            int      num      = index + dn.ChildCount;
            int      num2     = index + 1;

            while (!flag && num2 <= num)
            {
                DocumentNode documentNode = this.EntryAt(num2);
                if (documentNode.Type == DocumentNodeType.dnParagraph && documentNode.IsNonEmpty)
                {
                    if (dirState == DirState.DirDefault)
                    {
                        dirState = documentNode.FormatState.DirPara;
                    }
                    else if (dirState != documentNode.FormatState.DirPara)
                    {
                        flag = true;
                    }
                }
                num2++;
            }
            if (!flag && dirState != DirState.DirDefault)
            {
                for (int i = index; i <= num; i++)
                {
                    DocumentNode documentNode2 = this.EntryAt(i);
                    if (documentNode2.Type == DocumentNodeType.dnList || documentNode2.Type == DocumentNodeType.dnListItem)
                    {
                        documentNode2.FormatState.DirPara = dirState;
                    }
                }
            }
        }
Ejemplo n.º 12
0
 internal static string AlignmentToString(HAlign a, DirState ds)
 {
     switch (a)
     {
         case HAlign.AlignLeft:
             return (ds != DirState.DirRTL) ? "Left" : "Right";
         case HAlign.AlignRight:
             return (ds != DirState.DirRTL) ? "Right" : "Left";
         case HAlign.AlignCenter:
             return "Center";
         case HAlign.AlignJustify:
             return "Justify";
         case HAlign.AlignDefault:
         default:
             return "";
     }
 }
Ejemplo n.º 13
0
            internal static bool ConvertToDir(ConverterState converterState, string dirName, ref DirState dirState)
            {
                if (dirName.Length == 0) 
                    return false;
 
                if (string.Compare("RightToLeft", dirName, StringComparison.OrdinalIgnoreCase) == 0) 
                {
                    dirState = DirState.DirRTL; 
                    return true;
                }
                else if (string.Compare("LeftToRight", dirName, StringComparison.OrdinalIgnoreCase) == 0)
                { 
                    dirState = DirState.DirLTR;
                    return true; 
                } 
                return false;
            }