void Start() { rb2d = GetComponent <Rigidbody2D>(); midX = Screen.width / 2; midY = Screen.height / 2; up = "w"; down = "s"; left = "a"; right = "d"; movestyles = movestyle.relative; }
void Start() { rb2d = GetComponent<Rigidbody2D>(); midX = Screen.width / 2; midY = Screen.height / 2; up = "w"; down = "s"; left = "a"; right = "d"; movestyles = movestyle.relative; }
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); }
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); }
/*------------------------------------------------------------------------------------------------------------------ * -- 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); } }
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); }
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); }
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); } }
public void setRel() { movestyles = movestyle.relative; }
public void setAbs() { movestyles = movestyle.absolute; }
/*------------------------------------------------------------------------------------------------------------------ * -- 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; }
/*------------------------------------------------------------------------------------------------------------------ * -- 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; }