virtual protected void CreateGunModule() { GunModule gunModule = new GunModule(); gunModule.Init(this); _gunModuleList.Add(gunModule); }
// Update is called once per frame private void Start() { gunComponent = new GunModule(this.isFiring, this.bullet, this.firePoint, this.bulletSpeed, this.shotInterval, this.shotCounter); Modules = new List <ScriptableObject>(); Modules.Add(gunComponent); TAccessor <GunModule> .Instance().Add(gunComponent); }
// Use this for initialization void Start() { //master = GameObject.FindWithTag("masterMind").GetComponent<MasterMindTranslate>(); master = GameObject.FindWithTag("masterMind").GetComponent<SynchronizeORCA>(); stats = GetComponentInParent<UnitStats>(); agents = master.agents; gun = GetComponent<GunModule>(); }
protected Shell MakeShell(ShellType shellType, GunModule module) { Shell shell = null; switch (shellType) { case ShellType.ARMOR_PIERCING: { GameObject shellGo = Resources.Load("ARMOR_PIERCING") as GameObject; // shell = shellGo.GetComponent <Shell>(); shell.ShellType = shellType; shell.AttackValue = module.AttackValue; shell.AttackValue += 50; shell.shellColor = Color.red; } break; case ShellType.ARMOR_PIERCING_SUBCIBER: { GameObject shellGo = Resources.Load("ARMOR_PIERCING_SUBCIBER") as GameObject; // shell = shellGo.GetComponent <Shell>(); shell.ShellType = shellType; shell.AttackValue = module.AttackValue; shell.AttackValue += 60; shell.shellColor = Color.black; } break; case ShellType.HIGH_EXPLOSIVE: { GameObject shellGo = Resources.Load("HIGH_EXPLOSIVE") as GameObject; // shell = shellGo.GetComponent <Shell>(); shell.ShellType = shellType; shell.AttackValue = module.AttackValue; shell.AttackValue += 70; shell.shellColor = Color.yellow; } break; } return(shell); }
public GunModule GetGunModuleInfo(int gunModuleNumber) { if (gunModulePrefab == null) { gunModulePrefab = Resources.Load("PlayerTower") as GameObject; } GunModule gunModule = gunModulePrefab.GetComponent <GunModule>(); switch (gunModuleNumber) { case 0: { gunModule.InitGunModuleWithoutShells(playerTankPrefab, Color.black, 100.0f, 20, "Module 1", gunModuleNumber); } break; case 1: { gunModule.InitGunModuleWithoutShells(playerTankPrefab, Color.green, 120.0f, 40, "Module 2", gunModuleNumber); } break; case 2: { gunModule.InitGunModuleWithoutShells(playerTankPrefab, Color.red, 155.0f, 35, "Module 3", gunModuleNumber); } break; } var shell_1 = MakeShell(ShellType.ARMOR_PIERCING, gunModule).gameObject; var shell_2 = MakeShell(ShellType.ARMOR_PIERCING_SUBCIBER, gunModule).gameObject; var shell_3 = MakeShell(ShellType.HIGH_EXPLOSIVE, gunModule).gameObject; gunModule.Shells[0] = shell_1; gunModule.Shells[1] = shell_2; gunModule.Shells[2] = shell_3; return(gunModule); }