Example #1
0
    public void hit(string id, int damage)
    {
        GameObject   client       = clients[id];
        StatusPlayer clientStatus = client.GetComponent <StatusPlayer>();

        clientStatus.hpPlayerDamage(damage);
    }
Example #2
0
    private void MovePlayer()
    {
        float xPos = Input.GetAxis("Horizontal");
        //float ySpeed = rb2D.velocity.y;
        float ySpeedActual = rb2D.velocity.y;

        if (Mathf.Abs(xPos) > 0.01f)
        {
            playerAnimator.SetBool("Running", true);
        }
        else
        {
            playerAnimator.SetBool("Running", false);
        }

        if (status == StatusPlayer.Jumping)
        {
            status = StatusPlayer.Stop;
            if (IsInGround() == true)
            {
                rb2D.velocity = new Vector2(xPos * speed, jumpForce);
            }
            else
            {
                rb2D.velocity = new Vector2(xPos * speed, ySpeedActual); // Esto sirve para que cuando el player salte puede moverse en el aire
            }
        }
        else
        {
            rb2D.velocity = new Vector2(xPos * speed, ySpeedActual);
        }
    }
Example #3
0
 public Croupier()
 {
     Loss        = 0;
     Win         = 0;
     PlayerCards = new List <Card>();
     State       = StatusPlayer.Play;
 }
Example #4
0
    public void attackAnotherPlayer(RaycastHit2D rayHit)
    {
        GameObject   targetGameObject = rayHit.transform.gameObject as GameObject;
        StatusPlayer status           = targetGameObject.GetComponent <StatusPlayer>();

        status.hpPlayerDamage(damageSize);
    }
Example #5
0
 public void BateuChao()
 {
     if (status != StatusPlayer.walk)
     {
         anim.SetInteger("chao", 2);
         status = StatusPlayer.idle;
     }
 }
Example #6
0
    void OnTriggerEnter(Collider other)
    {
        StatusPlayer player = other.GetComponent <StatusPlayer>();

        if (player != null)
        {
            player.hpPlayerDamage(damageHP);
        }
        Destroy(this.gameObject);
    }
Example #7
0
    public void addClient(string id, Vector3 pos, Quaternion rot, GameObject objPrefab)
    {
        GameObject gameObject = Instantiate(objPrefab, pos, rot) as GameObject;

        gameObject.transform.rotation = rot;
        StatusPlayer status = gameObject.GetComponent <StatusPlayer>();

        status.Id = id;
        clients.Add(id, gameObject);
    }
    void OnCollisionEnter(Collision collision)
    {
        if (collision.gameObject.name == "Player")
        {
            Debug.Log("UPs");
            player = collision.gameObject.GetComponent <StatusPlayer>();
            player.hpPlayerDamage(damageHp);

            Destroy(gameObject);
        }
    }
Example #9
0
        async void OpenStatusPlayer(string id)
        {
            var ficha = PlayerList.FirstOrDefault(x => x.IdJogador == id);
            var page  = new StatusPlayer(ficha, TheReino);

            page.Disappearing += (sender, e) =>
            {
                BuscarFichas();
            };
            await Navigation.PushAsync(page);
        }
Example #10
0
 public void Jump()
 {
     if (onGround)
     {
         Rigidbody rb = this.GetComponent <Rigidbody>();
         onGround = false;
         status   = StatusPlayer.jump;
         anim.SetInteger("chao", 1);
         rb.AddForce(0, 3.7f * rb.mass, 0, ForceMode.Impulse);
     }
 }
Example #11
0
    public void MovePlayer(Vector2 input)
    {
        //Vector2 input = new Vector2(MSJoystickController.joystickInput.x, MSJoystickController.joystickInput.y);
        Vector3 movement = Vector3.zero;

        switch (posiCam)
        {
        case PositionCam.front:
            movement = new Vector3(input.x, 0, input.y);
            break;

        case PositionCam.right:
            movement = new Vector3(-input.y, 0, input.x);
            break;

        case PositionCam.left:
            movement = new Vector3(input.y, 0, -input.x);
            break;

        case PositionCam.back:
            movement = new Vector3(-input.x, 0, -input.y);
            break;
        }
        if (movement != Vector3.zero && holdingBox == 0)
        {
            if (status != StatusPlayer.jump)
            {
                status = StatusPlayer.walk;
            }
            transform.rotation           = Quaternion.RotateTowards(this.transform.rotation, Quaternion.LookRotation(movement), 50 * Time.deltaTime * 15);
            body.transform.localRotation = Quaternion.Euler(Vector3.zero);
            body.transform.localPosition = Vector3.zero;
        }
        else
        {
            if (status != StatusPlayer.jump)
            {
                status = StatusPlayer.idle;
            }
        }
        movement = movement.normalized * speed * Time.deltaTime;
        if (holdingBox != 1)
        {
            transform.position += movement;

            //rb.velocity = new Vector3(movement.x, rb.velocity.y, movement.z);
            //transform.Translate(movement.normalized * speed * Time.deltaTime);
            if (holdingBox == 2)
            {
                boxHold.Move(movement);
            }
        }
    }
Example #12
0
 public void SetGame(Color startColor, StatusPlayer pl1, StatusPlayer pl2, int depth1, int depth2,
                     Search s1, Search s2, Evaluate e1, Evaluate e2, StatusGame statusGame)
 {
     statusApplication        = StatusApplication.game;
     color                    = startColor;
     statusPlayer[(int)color] = pl1;
     statusPlayer[(int)GetOtherColor(color)] = pl2;
     statusSearch[(int)color] = s1;
     statusSearch[(int)GetOtherColor(color)] = s2;
     statusDepth[(int)color] = depth1;
     statusDepth[(int)GetOtherColor(color)]    = depth2;
     statusEvaluate[(int)color]                = e1;
     statusEvaluate[(int)GetOtherColor(color)] = e2;
     this.statusGame = statusGame;
 }
Example #13
0
        async void OpenStatusPlayer()
        {
            var ficha = new Ficha()
            {
                IdJogador = "",
                Nome      = "Novo Personagem"
            };
            var page = new StatusPlayer(ficha, TheReino);

            page.Disappearing += (sender, e) =>
            {
                BuscarFichas();
            };
            await Navigation.PushAsync(page);
        }
Example #14
0
    public override void CaculateStatus()
    {
        LoadCurrPosionPlayer();
        base.CaculateStatus();
        if (high >= 0.5f)
        {
            Status_Player = StatusPlayer.Jump;
        }
        else if (high < 0.5f)
        {
            Status_Player = StatusPlayer.Ground;
        }



        base.CaculateStatus();
    }
Example #15
0
    void Start()
    {
        _StatusPlayer = gameObject.GetComponent <StatusPlayer>();
        //_PlayerGui.InvBag.InventoryOpen += LoadItemsInBag;

        nameSaveStats   += _StatusPlayer.personalName + ".stat";
        nameSaveBag     += _StatusPlayer.personalName + ".bag";
        nameSaveEquip   += _StatusPlayer.personalName + ".equip";
        nameSaveStorage += _StatusPlayer.personalName + ".stor";

        if (System.IO.File.Exists(System.IO.Path.Combine(Application.persistentDataPath, nameSaveBag)))
        {
            LoadBagFromSave();
        }

        if (System.IO.File.Exists(System.IO.Path.Combine(Application.persistentDataPath, nameSaveEquip)))
        {
            LoadEquipFromSave();
        }
    }
Example #16
0
    public void checkPlayer()
    {
        Vector3    point = transform.TransformDirection(Vector3.forward);
        RaycastHit hit;

        if (Physics.SphereCast(transform.position, 2, point, out hit))
        {
            if (StenaLive == false)
            {
                spawnCam = transform.localPosition;
            }

            GameObject   hitObject = hit.transform.gameObject;
            StatusPlayer player    = hitObject.GetComponent <StatusPlayer>();
            if (player != null)
            {
                dist = hit.distance;
            }
        }
    }
    protected override void Start()
    {
        typeParentInv             = TypeParentInv.equip;
        _StatusPlayer             = PlayerController.currPlayer._StatusPlayer;
        _StatusPlayer.OnChangeExp = RefreshExpLvl;

        itemEquipTypes = new ItemEquipType[] {
            ItemEquipType.Agation, ItemEquipType.Head, ItemEquipType.Wings,
            ItemEquipType.WeaponRightHend, ItemEquipType.Chest, ItemEquipType.WeaponLeftHend,
            ItemEquipType.Hands, ItemEquipType.Pants, ItemEquipType.Shoes,
            ItemEquipType.RingRight, ItemEquipType.Necklace, ItemEquipType.RingLeft
        };
        itemsEquipedData = new List <ItemEquipedData>(12);
        for (int i = 0; i < itemEquipTypes.Length; i++)
        {
            itemsEquipedData.Add(new ItemEquipedData(itemEquipTypes[i], new ItemEquip()));
        }

        base.Start();
    }
Example #18
0
    public void Move()
    {
        Ray        rayForward = new Ray(transform.position, transform.forward);
        RaycastHit hit;

        if (Physics.SphereCast(rayForward, 0.75f, out hit, 100.0f))
        {
            GameObject   hitObject = hit.transform.gameObject;
            StatusPlayer player    = hitObject.GetComponent <StatusPlayer>();
            if (player != null)
            {
                //player.hpPlayerDamage(damagePlayerHp);
            }

            if (hit.distance < obstacleRange && player == null)
            {
                float angle = Random.Range(-110, 110);
                transform.Rotate(0, angle, 0);
            }
        }
    }
Example #19
0
    public void FireRifle()
    {
        if (Input.GetKeyDown(KeyCode.Mouse0) && reloadActive == false && ammoRifle > 0 && polKursor == menuAlive.game && currentGun == CurrentWeapon.rifle)
        {
            audio.PlayOneShot(firePistol);
            ammoRifle--;
            int        posx  = Random.Range(1, 10);
            int        posy  = Random.Range(1, 10);
            Vector3    point = new Vector3(mainCamera.pixelWidth / 2 - posx + posy, mainCamera.pixelHeight / 2 + posx - posy, 0);
            Ray        ray   = mainCamera.ScreenPointToRay(point);
            RaycastHit hit;

            if (Physics.Raycast(ray, out hit))
            {
                GameObject     hitObject = hit.transform.gameObject;
                ReactiveTarget target    = hitObject.GetComponent <ReactiveTarget>();
                StatusPlayer   player    = hitObject.GetComponent <StatusPlayer>();

                if (target != null)
                {
                    target.ReactToHit();
                }
                else
                {
                    iskra.transform.position = hit.point;
                    iskra.Play();
                    if (player != null)
                    {
                        player.hpPlayerDamage(damageHP);
                    }
                    else
                    {
                        StartCoroutine(SphereIndicator(hit.point));
                    }
                }
            }
        }
    }
Example #20
0
 private void flipSprite()
 {
     status = StatusPlayer.WalkingL;
     if (Input.GetKeyDown(KeyCode.W))
     {
         status = StatusPlayer.Jumping;
         print("W PULSADA");
     }
     else if (Input.GetKey(KeyCode.D))
     {
         status             = StatusPlayer.WalkingR;
         playerSprite.flipX = false;
     }
     else if (Input.GetKeyDown(KeyCode.A))
     {
         status             = StatusPlayer.WalkingL;
         playerSprite.flipX = true;
     }
     else
     {
         status = StatusPlayer.Stop;
     }
 }
Example #21
0
            private void CreateCharacterStatus(BaseStatus.Character _character)
            {
                BaseStatus status;

                switch (_character)
                {
                case BaseStatus.Character.Player:
                    status = new StatusPlayer();
                    status.SetStatus(hp_, mp_, attack_, speed_, name_, startLevel_, ID_);
                    BaseStatus.CreateStatusObject <StatusPlayer>(status);
                    break;

                case BaseStatus.Character.Enemy:
                    status = new StatusEnemy();
                    status.SetStatus(hp_, mp_, attack_, speed_, name_, startLevel_, ID_);
                    BaseStatus.CreateStatusObject <StatusEnemy>(status);
                    break;

                default:
                    status = new BaseStatus();
                    break;
                }
            }
Example #22
0
 public void SayEnough()
 {
     State = StatusPlayer.Enough;
 }
Example #23
0
 void Start()
 {
     posiçãoOBj = GetComponent <Transform>();
     script     = player.GetComponent <StatusPlayer>();
     ballRb     = posiçãoOBj.GetComponent <Rigidbody>();
 }
Example #24
0
 public void SetStatusPlayers(StatusPlayer pl1, StatusPlayer pl2)
 {
     statusPlayer[0] = pl1;
     statusPlayer[1] = pl2;
 }
Example #25
0
 private void Awake()
 {
     statusPlayer   = GetComponent <StatusPlayer>();
     movementPlayer = GetComponent <MovementPlayer>();
     animatorPlayer = GetComponent <AnimatorPlayer>();
 }
Example #26
0
 private void Awake()
 {
     zonas  = player.GetComponent <StatusPlayer>();
     status = MestreMissao.GetComponent <QuestBegin>();
 }