void OnFire(CannonRevamped c /*, Vector2 recoil*/) { //if(s.cannon.charge>cannonThreshold){ // pitch=Mathf.Lerp(cannonPitchRange.x,cannonPitchRange.y,(s.cannon.charge-cannonThreshold)/(1-cannonThreshold)); // cannon.clip=cannonClips[Random.Range(0,cannonClips.Length)]; // cannonDry.clip=cannonDryClip; // AddSound(s.hasRowball?cannon:cannonDry,pitch); //} //else{ // pitch=Mathf.Lerp(cannonWeakPitchRange.x,cannonWeakPitchRange.y,s.cannon.charge/cannonThreshold); // if(s.hasRowball){ // cannon.clip=cannonWeakClip; // AddSound(cannon,pitch); // } // else{ // cannonDry.clip=cannonWeakDryClip; // AddSound(cannonDry,pitch); // } //} if (c.loaded) { AddSound(c.fireSoundLoaded, PlayerPrefs.GetFloat("effectsVolume", 1.0f)); } else { AddSound(c.fireSoundDry, PlayerPrefs.GetFloat("effectsVolume", 1.0f)); } }
public static CannonRevamped AddCannon(Point parent, Color color) { Vector3 cannonPosition = new Vector3(parent.position.x, parent.position.y, instance.cannon.transform.position.z); CannonRevamped c = Instantiate(instance.cannon, cannonPosition, Quaternion.identity) as CannonRevamped; c.transform.parent = parent.transform; c.color = color; c.gameObject.name = "Cannon"; return(c); }
//Build ship void Build() { regenerate = false; //TODO: help why please god SetTerrainAffectorOff(); Erase(); //Points points = new Point[edge.Length + 1]; //Center points[0] = ObjectManager.AddPoint(spawnPosition, module.pointMass, altColor, gameObject); for (int i = 1; i < edge.Length + 2; ++i) { //Edge if (i < edge.Length + 1) { points[i] = ObjectManager.AddPoint(spawnPosition + vertexOffset(edge[i - 1]), module.pointMass, color, gameObject); edge[i - 1].pointIndex = i; //Oars if (edge[i - 1].leftOar || edge[i - 1].rightOar) { points[i].AddOar(edge[i - 1].leftOar); } } // center.invisible = true; //Links if (i > 1) { Point start = points[i - 1], end = points[((i - 1) % edge.Length) + 1]; start.AddLink(end, Vector2.Distance(start.position, end.position), module.stiffness, module.damping, color); //Framework end = center; end.AddLink(start, Vector2.Distance(start.position, end.position), module.stiffness, module.damping, altColor, false); // } } //Cannon center.AddCannon(color); center.cannon.ship = this.GetComponent <ShipRevamped>(); this.cannon = center.cannon; //Deck center.AddDeck(); }
public void AddCannon(Color color) { cannon = ObjectManager.AddCannon(this, color); }
void OnFire(CannonRevamped c /*, Vector2 recoil*/) { //Bump(recoil*2,shotBump.delay,shotBump.punchDamping,shotBump.releaseDamping,Time.time); }