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 : MonoBehaviour
- {
- CardCollection myColection;
- // Start is called before the first frame update
- public GameObject axe;
- void Start()
- {
- myColection = ScriptableObject.CreateInstance<CardCollection>();
- myColection.Start();
- }
- // Update is called once per frame
- void Update()
- {
- bool isAnimationPlaying = axe.gameObject.GetComponent<Axe>();
- if (isAnimationPlaying == false)
- {
- if (Input.GetKeyDown(KeyCode.LeftArrow))
- {
- Vector3 position = this.transform.position;
- position.x--;
- this.transform.position = position;
- }
- if (Input.GetKeyDown(KeyCode.RightArrow))
- {
- Vector3 position = this.transform.position;
- position.x++;
- this.transform.position = position;
- }
- if (Input.GetKeyDown(KeyCode.UpArrow))
- {
- Vector3 position = this.transform.position;
- position.y++;
- this.transform.position = position;
- }
- if (Input.GetKeyDown(KeyCode.DownArrow))
- {
- Vector3 position = this.transform.position;
- position.y--;
- this.transform.position = position;
- }
- if (Input.GetKeyDown(KeyCode.Space))
- {
- var shooter = GetComponent<Shooter>();
- shooter.Fire();
- }
- if (Input.GetKeyDown(KeyCode.C))
- {
- var melee = GetComponent<Melee>();
- melee.Swing();
- //Debug.Log("hello");
- }
- if (Input.GetKeyDown(KeyCode.V))
- {
- var placeWall = GetComponent<WallPlacer>();
- placeWall.PlaceWall();
- //Debug.Log("hello");
- }
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement