Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Collections;
- using System.Collections.Generic;
- using UnityEngine;
- public class Player : Character
- {
- [SerializeField]
- private Stat health;
- [SerializeField]
- private float maxHealth;
- // Use this for initialization
- protected override void Start ()
- {
- health.Initialize(maxHealth, maxHealth);
- base.Start();
- }
- // Update is called once per frame
- protected override void Update ()
- {
- GetInpu();
- health.MyCurrentValue = 600;
- base.Update();
- }
- public void GetInpu()
- {
- direction = Vector2.zero;
- if (Input.GetKeyDown(KeyCode.I))
- {
- health.MyCurrentValue -= 100;
- }
- if (Input.GetKeyDown(KeyCode.O))
- {
- health.MyCurrentValue += 100;
- }
- if (Input.GetKey(KeyCode.UpArrow))
- {
- direction += Vector2.up;
- }
- if (Input.GetKey(KeyCode.LeftArrow))
- {
- direction += Vector2.left;
- }
- if (Input.GetKey(KeyCode.DownArrow))
- {
- direction += Vector2.down;
- }
- if (Input.GetKey(KeyCode.RightArrow))
- {
- direction += Vector2.right;
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement