Advertisement
Guest User

First

a guest
Aug 14th, 2017
151
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.52 KB | None | 0 0
  1. using System.Collections;
  2. using System.Collections.Generic;
  3. using UnityEngine;
  4.  
  5. public class PlayerController :  Spaceships  {
  6.        
  7.     private Rigidbody2D rb2d;
  8.    
  9.     //Активный тип корабля    
  10.     public ShipType activePlayerShipType = ShipType.M1;
  11.     //Активный тип оружия, RockShoot по дефолту
  12.     public Shootstype.ShootType activePlayerShootType = Shootstype.ShootType.RockShoot;
  13.     //Объявляем делегат
  14.     public delegate void ActivePlayerShootType();
  15.     //Переменная делегата
  16.     ActivePlayerShootType del;
  17.    
  18.     // Параметры корабля
  19.     public byte playerArmor;
  20.     public byte playerSpeed;
  21.     public byte playerMass;
  22.     public byte playerSize;
  23.    
  24.    
  25.         void Start ()
  26.     {
  27.  
  28.         rb2d = GetComponent<Rigidbody2D>();
  29.                        
  30.         //Проверка типа атаки
  31.         switch (activePlayerShootType)
  32.         {
  33.  
  34.             case Shootstype.ShootType.RockShoot:
  35.                 Debug.Log("RockShoot");
  36.                 del = Shootstype.RockShoot;
  37.                 break;
  38.  
  39.             case Shootstype.ShootType.BulletShoot:
  40.                 Debug.Log("BulletShoot");
  41.                 del = Shootstype.BulletShoot;
  42.                 break;
  43.         }
  44.    
  45.        
  46.              
  47.     }
  48.  
  49.  
  50.     void Update ()
  51.  
  52.  
  53.     {
  54.  
  55.         if (Input.GetButtonDown("Fire1"))
  56.         {
  57.             del();
  58.                  
  59.              
  60.         }
  61.    
  62.   }
  63.    
  64.  
  65. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement