示例#1
0
 public Clue(int number, EnumDir direction, int len, int xPos, int yPos, string text)
 {
     Number    = number;
     Direction = direction;
     Text      = text;
     Len       = len;
     XPos      = xPos;
     YPos      = yPos;
 }
示例#2
0
 public Bending(Bending previousB)
 {
     Orientation = previousB.Orientation;
     Index       = previousB.Index;
     Direction   = previousB.Direction;
     Angle       = previousB.Angle;
     Radius      = previousB.Radius;
     Length      = previousB.Length;
 }
示例#3
0
    private bool IsDirectionAdjacent(EnumDir a, EnumDir b)
    {
        if (a == EnumDir.CENTER || b == EnumDir.CENTER)
        {
            return(false);
        }

        int diff = Mathf.Abs((int)(a) - (int)(b));

        if (diff == 0 || diff == 1 || diff == 7)
        {
            return(true);
        }
        else
        {
            return(false);
        }
    }
示例#4
0
    // Update is called once per frame
    void Update()
    {
        //UPDATE INPUTS
        //UPDATE THESE TO AVERAGE OVER MULTIPLE FRAMES
        float RawHorz = Input.GetAxisRaw("Horizontal");
        float RawVert = Input.GetAxisRaw("Vertical");

        if (Dead)
        {
            Horizontal = 0;
            Vertical   = 0;
        }
        else if (NumInputsStored == 0)
        {
            Horizontal = RawHorz;
            Vertical   = RawVert;
        }
        else
        {
            Horizontal = (NumInputsStored * Horizontal + RawHorz) / (NumInputsStored + 1);
            Vertical   = (NumInputsStored * Vertical + RawVert) / (NumInputsStored + 1);
        }
        NumInputsStored++;
        heldJump = Input.GetButton("Jump");

        //UPDATE ACTION BASED INPUTS
        if (Input.GetButtonDown("Jump"))
        {
            QueuedAction     = EnumAction.JUMP;
            QueuedActionTime = Time.time;
        }
        else if (Input.GetButtonDown("Attack"))
        {
            QueuedAction          = EnumAction.BASIC_ATTACK;
            QueuedActionDirection = GetDirection(RawHorz, RawVert);
            QueuedActionTime      = Time.time;
        }
        else if (Input.GetButtonDown("Special"))
        {
            QueuedAction          = EnumAction.SPECIAL_ATTACK;
            QueuedActionDirection = GetDirection(RawHorz, RawVert);
            QueuedActionTime      = Time.time;
        }
        else if (Input.GetButtonDown("Pickup"))
        {
            QueuedAction          = EnumAction.PICKUP;
            QueuedActionDirection = GetDirection(RawHorz, RawVert);
            QueuedActionTime      = Time.time;
        }



        if (Horizontal > 0 && !GetFacingRight() && rb.velocity.x > 0 && !Attacking)
        {
            SetFacingRight(true);
        }
        else if (Horizontal < 0 && GetFacingRight() && rb.velocity.x < 0 && !Attacking)
        {
            SetFacingRight(false);
        }

        if (Horizontal == 0f && (rb.velocity.x < 0.01f && rb.velocity.x > -0.01f))        //player standing still
        {
            //set state to idle
            anim.SetInteger("Accel", 0);
        }
        else if (rb.velocity.x * Horizontal > 0)         //player is accelerating,
        {
            //set state to running
            anim.SetInteger("Accel", 1);
        }
        else         //Player is deccelerating
        {
            //set state to sliding
            anim.SetInteger("Accel", -1);
        }

        anim.SetBool("Falling", rb.velocity.y < 0);
    }