예제 #1
0
 void Start()
 {
     rb2d       = GetComponent <Rigidbody2D>();
     midX       = Screen.width / 2;
     midY       = Screen.height / 2;
     up         = "w";
     down       = "s";
     left       = "a";
     right      = "d";
     movestyles = movestyle.relative;
 }
예제 #2
0
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        midX = Screen.width / 2;
        midY = Screen.height / 2;
        up = "w";
        down = "s";
        left = "a";
        right = "d";
        movestyles = movestyle.relative;
       

    }
예제 #3
0
    void Start()
    {
        rb2d = GetComponent<Rigidbody2D>();
        midX = Screen.width / 2;
        midY = Screen.height / 2;
        up = "w";
        down = "s";
        left = "a";
        right = "d";
        movestyles = movestyle.relative;
		anim = gameObject.GetComponent<Animator>();
        ClassStat = GetComponent<BaseClass>().ClassStat;
        GameData.PlayerPosition.Add(GameData.MyPlayer.PlayerID, transform.position);
    }
예제 #4
0
 void Start()
 {
     rb2d       = GetComponent <Rigidbody2D>();
     midX       = Screen.width / 2;
     midY       = Screen.height / 2;
     up         = "w";
     down       = "s";
     left       = "a";
     right      = "d";
     movestyles = movestyle.absolute;
     anim       = gameObject.GetComponent <Animator>();
     baseClass  = gameObject.GetComponent <BaseClass>();
     GameData.PlayerPosition.Add(GameData.MyPlayer.PlayerID, transform.position);
 }
예제 #5
0
/*------------------------------------------------------------------------------------------------------------------
 * -- FUNCTION:  update
 * -- DATE:	   10/04/16
 * -- REVISIONS:  (V1.0)
 * -- DESIGNER:   Colin Bose
 * -- PROGRAMMER: Colin Bose
 * --
 * --
 * -- RETURNS:    VOID
 * --
 * -- NOTES: The update function, called 60 times per sec
 * --
 * ----------------------------------------------------------------------------------------------------------------------*/

    void Update()
    {
        speed = baseClass.ClassStat.MoveSpeed;
        if (speed == 0)
        {
            if (baseClass is GunnerClass)
            {
                baseClass.ClassStat.MoveSpeed = 6;
            }
            else
            if (baseClass is NinjaClass)
            {
                baseClass.ClassStat.MoveSpeed = 7;
            }
            else
            if (baseClass is WizardClass)
            {
                baseClass.ClassStat.MoveSpeed = 5;
            }
        }
        if (Input.GetKeyDown(KeyCode.Equals) && !GameData.InputBlocked)
        {
            movestyles = (movestyles == movestyle.absolute ? movestyle.relative : movestyle.absolute);
        }

        if (movestyles == movestyle.absolute)
        {
            absMove();
        }
        else
        {
            relMove();
        }
        //Will need to send some info to server every update
        sendToServer(rb2d.position.x, rb2d.position.y);
        GameData.PlayerPosition[GameData.MyPlayer.PlayerID] = transform.position;

        // animation trigger test
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
        {
            anim.SetBool("moving", true);
        }
        if (Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.D))
        {
            anim.SetBool("moving", false);
        }
    }
예제 #6
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Equals))
            movestyles = movestyles == movestyle.absolute ? movestyle.relative : movestyle.absolute;

        if (movestyles == movestyle.absolute)
        {
            absMove();
        }
        else
        {
            relMove();
        }
        //Will need to send some info to server every update
        sendToServer(rb2d.position.x, rb2d.position.y);

    }
예제 #7
0
    void Update()
    {
        if (Input.GetKeyDown(KeyCode.Equals))
        {
            movestyles = movestyles == movestyle.absolute ? movestyle.relative : movestyle.absolute;
        }

        if (movestyles == movestyle.absolute)
        {
            absMove();
        }
        else
        {
            relMove();
        }
        //Will need to send some info to server every update
        sendToServer(rb2d.position.x, rb2d.position.y);
    }
예제 #8
0
    void Update()
    {
        speed = ClassStat.MoveSpeed;
		if (Input.GetKeyDown(KeyCode.Equals) && !GameData.InputBlocked)
            movestyles = (movestyles == movestyle.absolute ? movestyle.relative : movestyle.absolute);

        if (movestyles == movestyle.absolute)
        {
            absMove();
        }
        else
        {
            relMove();
        }
        //Will need to send some info to server every update
        sendToServer(rb2d.position.x, rb2d.position.y);
        GameData.PlayerPosition[GameData.MyPlayer.PlayerID] = transform.position;

        // animation trigger test
        if (Input.GetKey(KeyCode.W) || Input.GetKey(KeyCode.A) || Input.GetKey(KeyCode.S) || Input.GetKey(KeyCode.D))
        {
            anim.SetBool("moving", true);
        }
        if (Input.GetKeyUp(KeyCode.W) || Input.GetKeyUp(KeyCode.A) || Input.GetKeyUp(KeyCode.S) || Input.GetKeyUp(KeyCode.D))
        {
            anim.SetBool("moving", false);
        }
    }
예제 #9
0
 public void setRel()
 {
     movestyles = movestyle.relative;
 }
예제 #10
0
 public void setAbs()
 {
     movestyles = movestyle.absolute;
 }
예제 #11
0
    /*------------------------------------------------------------------------------------------------------------------
     * -- FUNCTION:  setRel
     * -- DATE:	   10/04/16
     * -- REVISIONS:  (V1.0)
     * -- DESIGNER:   Colin Bose
     * -- PROGRAMMER: Colin Bose
     * --
     * --
     * -- RETURNS: VOID
     * --
     * -- NOTES: sets movement to relative
     * --
     * ----------------------------------------------------------------------------------------------------------------------*/

    public void setRel()
    {
        movestyles = movestyle.relative;
    }
예제 #12
0
    /*------------------------------------------------------------------------------------------------------------------
     * -- FUNCTION:  setAbs
     * -- DATE:	   10/04/16
     * -- REVISIONS:  (V1.0)
     * -- DESIGNER:   Colin Bose
     * -- PROGRAMMER: Colin Bose
     * --
     * --
     * -- RETURNS:    void
     * --
     * -- NOTES: Sets movement styel to absolute
     * --
     * ----------------------------------------------------------------------------------------------------------------------*/

    public void setAbs()
    {
        movestyles = movestyle.absolute;
    }