/// <summary>
 /// Checks input for a change in target position
 /// </summary>
 private void CheckMovementInput()
 {
     if (spellCaster.IsCasting() || InGameWrapper.instance.aimWrapper.IsAiming())
     {
         return;
     }
     if (deviceInput.MouseButtonHeldDown())
     {
         if (EventSystemReference.instance.EventSystem.IsPointerOverGameObject(deviceInput.GetMousePointerId()))
         {
             return;
         }
         RaycastHit hit      = new RaycastHit();
         Ray        mouseRay = InGameWrapper.instance.camera.ScreenPointToRay(Input.mousePosition);
         if (Physics.Raycast(mouseRay, out hit, 100f, generalPlayerData.groundMask))
         {
             Debug.DrawLine(playerGmj.transform.position, hit.point);
             var newTargetPos = new Vector3(hit.point.x, playerGmj.transform.position.y, hit.point.z);
             if (newTargetPos == targetPos)
             {
                 return;
             }
             InGameWrapper.instance.cursorWrapper.SetPosition(newTargetPos);
             SetTargetPos(new Vector3(hit.point.x, StaticVariables.GetYPos(), hit.point.z));
         }
     }
 }
Ejemplo n.º 2
0
    Vector3 GetPositionForPlayer(float playerNr, float length)
    {
        float fullAngle = 360;
        float angle     = fullAngle * (playerNr / countOfAllPlayers);
        var   v         = DegreeToVector2(angle) * length;

        return(new Vector3(v.x, StaticVariables.GetYPos(), v.y));
    }
    private void Teleport()
    {
        isDead = true;
        var player = InGameWrapper.instance.playersWrapper.GetPlayerByOwnerGUID(spell.request.ownerGUID);

        player.SetCurrentPos(new Vector3(spell.request.spellXPos, StaticVariables.GetYPos(), spell.request.spellZPos));
        player.SetTargetPos(new Vector3(spell.request.spellXPos, StaticVariables.GetYPos(), spell.request.spellZPos));
    }
 public PlayerController(GameObject playerGmj, Message_ServerCommand_CreateGameObject info, UnityPlayerData generalPlayerData, IDeviceInput deviceInput)
 {
     alive = true;
     playerScoreController  = new PlayerScoreController();
     spellCaster            = new SpellCasterController(this);
     playerAnimator         = new PlayerAnimatorController(playerGmj);
     healthController       = new PlayerHealthController(this, generalPlayerData);
     this.playerGmj         = playerGmj;
     this.generalPlayerData = generalPlayerData;
     PlayerControllerGUID   = info.GmjGUID;
     OwnerID = info.OwnerGUID;
     playerGmj.transform.position = new Vector3(info.transform.xPos, StaticVariables.GetYPos(), info.transform.zPos);
     targetPos        = playerGmj.transform.position;
     this.deviceInput = deviceInput;
 }