void ArmWeaponUpdate(WeaponUI weapon_ui)
    {
        if (!weapon_ui.gameObject.activeSelf) return;

        switch (weapon_ui.getArmWeapon)
        {
            case ArmWeapon.AssaultRifle:
                text_.text =
                    "威力:" + weapon_A_1 +
                    "\n\n" +
                    "\n射程:" + weapon_A_2 +
                    "\n\n" +
                    "\n連射:" + weapon_A_3;
                break;

            case ArmWeapon.ShotGun:
                text_.text =
                    "威力:" + weapon_B_1 +
                    "\n\n" +
                    "\n射程:" + weapon_B_2 +
                    "\n\n" +
                    "\n連射:" + weapon_B_3;
                break;

            case ArmWeapon.GatlingGun:
                text_.text =
                    "威力:" + weapon_C_1 +
                    "\n\n" +
                    "\n射程:" + weapon_C_2 +
                    "\n\n" +
                    "\n連射:" + weapon_C_3;
                break;
        }
    }
Exemple #2
0
    public override void Init(UnitControl _owner)
    {
        base.Init(_owner);
        type             = WeaponType.Ranged;
        projectilePrefab = gameManager.GetPrefab("Projectile");
        muzzle           = transform.Find("Muzzle");
        GameObject muzzleFlashObj = Instantiate(gameManager.GetPrefab("MuzzleFlash"), muzzle);

        muzzleFlash = muzzleFlashObj.GetComponent <MuzzleFlash>();
        magazine    = transform.Find("Magazine");
        rounds      = magazineSize;

        if (_owner.IsPlayer)
        {
            if (hasScope)
            {
                GameObject scopeCamObj = Instantiate(gameManager.GetPrefab("ScopeCam"), muzzle);
                scope = scopeCamObj.AddComponent <ScopeControl>();
                scopeCamObj.transform.localRotation = Quaternion.identity;
            }

            if (needsUI)
            {
                GameObject weaponUIObj = Instantiate(gameManager.GetPrefab("WeaponUI"));
                weaponUI = weaponUIObj.GetComponent <WeaponUI>();
                weaponUI.Init(this);
            }
        }
    }
 void Start()
 {
     weaponUI = GetComponentInChildren <WeaponUI>();
     weaponUI.transform.GetChild(0).gameObject.SetActive(true);
     slotMachinePointAggegator = GetComponentInChildren <SlotMachinePointAggegator>();
     weaponUI.transform.GetChild(0).gameObject.SetActive(false);
 }
    // Start is called before the first frame update
    void Start()
    {
        setter = FindObjectOfType <WeaponSetter>();
        Assert.IsNotNull(setter, "Weapon Messenger could not locate Weapon Setter.");
        ui = FindObjectOfType <WeaponUI>();
        Assert.IsNotNull(ui, "Weapon Messenger could not locate Weapon UI.");

        defaultColor = GetComponent <Text>().color;
    }
Exemple #5
0
 // Start is called before the first frame update
 void Start()
 {
     instance = GameManager.instance;
     Assert.IsNotNull(instance, "Weapon Rule Manager could not find Game Manager.");
     Assert.IsNotNull(searchField, "Search Field has not been assigned to Weapon Rule Manager.");
     setter = GetComponent <WeaponSetter>();
     Assert.IsNotNull(setter, "Weapon Rule Manager could not find Weapon Setter.");
     ui = GetComponent <WeaponUI>();
     Assert.IsNotNull(ui, "Weapon Rule Manager could not find Weapon UI.");
 }
Exemple #6
0
    void Awake()
    {
        if (instance != null)
        {
            Debug.LogWarning("Multiple WeaponUI instances.");
            return;
        }

        instance = this;
    }
Exemple #7
0
    // Start is called before the first frame update
    void Start()
    {
        manager = FindObjectOfType <WeaponRuleManager>();
        Assert.IsNotNull(manager, "Weapon Rule Button can not locate Weapon Rule Manager.");
        setter = FindObjectOfType <WeaponSetter>();
        Assert.IsNotNull(setter, "Weapon Rule Button can not locate Weapon Setter.");
        ui = FindObjectOfType <WeaponUI>();
        Assert.IsNotNull(ui, "Weapon Rule Button can not locate Weapon UI.");

        GetComponent <Button>().onClick.AddListener(AddRemoveRule);
    }
Exemple #8
0
    // Start is called before the first frame update
    void Start()
    {
        instance = GameManager.instance;
        Assert.IsNotNull(instance, "Weapon Loader could not find Game Manager.");
        messenger = FindObjectOfType <WeaponMessenger>();
        Assert.IsNotNull(messenger, "Weapon Loader could not find Weapon Messenger.");
        setter = gameObject.GetComponent <WeaponSetter>();
        Assert.IsNotNull(setter, "Weapon Loader could not find Weapon Setter.");
        ui = gameObject.GetComponent <WeaponUI>();
        Assert.IsNotNull(ui, "Weapon Loader could not find Weapon UI.");

        weaponsLoaded = instance.Weapons.Count > 0;
    }
Exemple #9
0
    // Use this for initialization
    void Start()
    {
        instance = GameManager.instance;
        Assert.IsNotNull(instance, "Can not find Game Manger.");
        loader = FindObjectOfType <WeaponLoader>();
        Assert.IsNotNull(loader, "Can not find Rule Loader.");
        setter = FindObjectOfType <WeaponSetter>();
        Assert.IsNotNull(setter, "Can not find Rule Setter.");
        ui = FindObjectOfType <WeaponUI>();
        Assert.IsNotNull(ui, "Can not find Rule UI.");

        GetComponent <Button>().onClick.AddListener(LoadWeapon);
    }
Exemple #10
0
    // Start is called before the first frame update
    void Start()
    {
        instance  = GameManager.instance;
        loader    = GetComponent <WeaponLoader>();
        messenger = FindObjectOfType <WeaponMessenger>();
        setter    = GetComponent <WeaponSetter>();
        ui        = GetComponent <WeaponUI>();

        Assert.IsNotNull(instance, "Weapon Saver could not locate Game Manager");
        Assert.IsNotNull(loader, "Weapon Saver could not locate Weapon Loader.");
        Assert.IsNotNull(messenger, "Weapon Saver could not locate Weapon Messenger.");
        Assert.IsNotNull(setter, "Weapon Saver could not locate Weapon Setter.");
        Assert.IsNotNull(ui, "Weapon Saver could not locate Weapon Ui.");
    }
Exemple #11
0
    private void Awake()
    {
        Debug.Log("Weapon Awake");
        weaponUI  = GetComponent <WeaponUI>();
        weaponSFX = GetComponent <WeaponSFX>();

        weaponGFXgameObject = transform.Find("GFX").gameObject;
        weaponUIgameObject  = transform.Find("Canvas").gameObject;

        //Enable UI and Disable GFX
        weaponUIgameObject.SetActive(true);
        weaponGFXgameObject.SetActive(false);

        timeLeftToSpawn  = weaponDetails.timeToConstruct;
        currentShootRate = weaponDetails.shootRate;

        //ADD GIZMO
        gameObject.AddComponent <WeaponGizmo>().radius = weaponDetails.weaponRadius;
    }
Exemple #12
0
 public void Init()
 {
     Instance = this;
 }
 private void Awake()
 {
     _weaponUI = FindObjectOfType <WeaponUI>();
 }
 public void SetWeaponUi(WeaponUI weaponUi)
 {
     this.weaponUi = weaponUi;
 }
 private void Awake()
 {
     instance = this;
 }
Exemple #16
0
 void Start()
 {
     ui = GameObject.FindGameObjectWithTag("WeaponUI").GetComponent <WeaponUI>();
     ChangeWeapon(weapons[0]);
 }