/** * @brief Initial setup when game is started. **/ public override void OnSyncedStart() { tsRigidBody = GetComponent <TSRigidBody2D>(); animator = GetComponent <Animator> (); spriteRenderer = GetComponent <SpriteRenderer> (); // Sets sprite and animator controller based on player's id if (owner.Id == 1) { animator.runtimeAnimatorController = animatorControllers [0]; spriteRenderer.sprite = sprites [0]; tsRigidBody.position = new TSVector2(1, 0); } else { animator.runtimeAnimatorController = animatorControllers [1]; spriteRenderer.sprite = sprites [1]; spriteRenderer.flipX = true; TSVector2 offset = new TSVector2(-0.63f, -0.87f); tsRigidBody.GetComponent <TSCollider2D>().Center = offset; tsRigidBody.position = new TSVector2(-1 - offset.x, 0); } // stops Animation animator.Stop(); // take control of the animation animator.StopPlayback(); }
public void SetTarget(TSRigidBody2D i_Target) { m_Reference = i_Target; m_ReferenceTransform = (m_Reference != null) ? m_Reference.GetComponent <TSTransform2D>() : null; }
public override void OnSyncedUpdate() { tsRigidBody.GetComponent <TSTransform2D>().rotation -= 5; }