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 PlayerController : Spaceships {
- private Rigidbody2D rb2d;
- //Активный тип корабля
- public ShipType activePlayerShipType = ShipType.M1;
- //Активный тип оружия, RockShoot по дефолту
- public Shootstype.ShootType activePlayerShootType = Shootstype.ShootType.RockShoot;
- //Объявляем делегат
- public delegate void ActivePlayerShootType();
- //Переменная делегата
- ActivePlayerShootType del;
- // Параметры корабля
- public byte playerArmor;
- public byte playerSpeed;
- public byte playerMass;
- public byte playerSize;
- void Start ()
- {
- rb2d = GetComponent<Rigidbody2D>();
- //Проверка типа атаки
- switch (activePlayerShootType)
- {
- case Shootstype.ShootType.RockShoot:
- Debug.Log("RockShoot");
- del = Shootstype.RockShoot;
- break;
- case Shootstype.ShootType.BulletShoot:
- Debug.Log("BulletShoot");
- del = Shootstype.BulletShoot;
- break;
- }
- }
- void Update ()
- {
- if (Input.GetButtonDown("Fire1"))
- {
- del();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement