// Use this for initialization private void Start () { if(!gameObject.GetComponent("DataShells")) { currentShell = gameObject.AddComponent("DataShells") as DataShells; } else if(currentShell == null) { currentShell = gameObject.AddComponent("DataShells") as DataShells; } else { currentShell = gameObject.GetComponent("DataShells") as DataShells; } currentShell.CurrentShell = ShellCaliber; if(ShellCaliber.ToString() == DataShells.ShellSize.mm100.ToString()) { Weight = 500; } else if(ShellCaliber.ToString() == DataShells.ShellSize.mm80.ToString()) { Weight = 350; } else { Weight = 200; } }
// Use this for initialization private void Start() { if (!gameObject.GetComponent("DataShells")) { currentShell = gameObject.AddComponent("DataShells") as DataShells; } else if (currentShell == null) { currentShell = gameObject.AddComponent("DataShells") as DataShells; } else { currentShell = gameObject.GetComponent("DataShells") as DataShells; } currentShell.CurrentShell = ShellCaliber; if (ShellCaliber.ToString() == DataShells.ShellSize.mm100.ToString()) { Weight = 500; } else if (ShellCaliber.ToString() == DataShells.ShellSize.mm80.ToString()) { Weight = 350; } else { Weight = 200; } }
private void SetAmmoData() { fireShellData.Shell = shell.rigidbody; fireShellData.SpawnPoint = GameObject.Find(user + "ShellSpawnPoint"); fireShellData.isAlive = true; fireShellData.smoke = gunSmoke; hatchControlData = hatchControl.AddComponent("DataHatchControl") as DataHatchControl; hatchControlData.Power = 30; hatchControlData.RocketCaliber = rocketCaliber; shellData = shell.AddComponent("DataShells") as DataShells; shellData.CurrentShell = shellCaliber; shellData.Reload(); rocketData = rocket.AddComponent("DataRockets") as DataRockets; rocketData.CurrentRocket = hatchControlData.RocketCaliber; rocketData.Reload(); }
private DataGun EditGunData(DataGun gun, int rotationSpeed, int traverse, int depression, double reloadTime, int power, DataShells.ShellSize shellCaliber) { gun.RotationSpeed = rotationSpeed; gun.AngleTraverse = traverse; gun.AngleDepression = depression; gun.ReloadTime = reloadTime; gun.Power = power; gun.ShellCaliber = shellCaliber; return gun; }
private void SetAmmoData() { fireShellData.Shell = shell.rigidbody; fireShellData.SpawnPoint = GameObject.Find (user+"ShellSpawnPoint"); fireShellData.isAlive = true; fireShellData.smoke = gunSmoke; hatchControlData = hatchControl.AddComponent("DataHatchControl") as DataHatchControl; hatchControlData.Power = 30; hatchControlData.RocketCaliber = rocketCaliber; shellData = shell.AddComponent("DataShells") as DataShells; shellData.CurrentShell = shellCaliber; shellData.Reload(); rocketData = rocket.AddComponent("DataRockets") as DataRockets; rocketData.CurrentRocket = hatchControlData.RocketCaliber; rocketData.Reload(); }