public static Color VisualColor(LaserColor color) { switch (color) { default: case LaserColor.Black: return(UnityEngine.Color.black); case LaserColor.Red: return(UnityEngine.Color.red); case LaserColor.Green: return(UnityEngine.Color.green); case LaserColor.Blue: return(UnityEngine.Color.blue); case LaserColor.Yellow: return(UnityEngine.Color.yellow); case LaserColor.Magenta: return(UnityEngine.Color.magenta); case LaserColor.Cyan: return(UnityEngine.Color.cyan); case LaserColor.White: return(UnityEngine.Color.white); } }
public static Laser Combine(Laser laser1, Laser laser2, bool combinePower = true) { LaserColor color = Combine(laser1.Color, laser2.Color); int power = Combine(laser1.Power, laser2.Power, combinePower); return(new Laser(color, power)); }
private void FireGun(GameObject gun) { Vector3 gunFocalPoint = transform.position + transform.forward * Beam.DefaultMaxRange; LaserColor beamColor = (ship.ShipFaction == ShipFaction.Empire) ? LaserColor.Green : LaserColor.Orange; float initalIntensity = powerDistributionSystem == null ? 1 : powerDistributionSystem.LaserPower; beamPool.FireAt(GameObjects.GetParentShip(transform.gameObject), gun.transform, gunFocalPoint, initalIntensity, Beam.DefaultMaxRange, beamColor); }
public void checkIfCorrectLaserHit(GameObject projectile) { if (IsHitByLaser == false) { if (projectile.GetComponent <Laser>().LaserColor.ToString() == LaserColor.ToString()) { IsHitByLaser = true; IsHitByCorrectLaser = true; GameManager.Instance.UpdateEndPointStatus(true); } else { IsHitByLaser = true; GameManager.Instance.UpdateEndPointStatus(false); } } }
private void UpdateRaserControll() { if (!_isShooting) { //右键切换激光颜色 if (Input.GetMouseButtonDown(1)) { if (laserColor == LaserColor.Blue) { laserColor = LaserColor.Red; RaserMat.SetColor("_Color", RedColor * 4); } else { laserColor = LaserColor.Blue; RaserMat.SetColor("_Color", BlueColor * 4); } } } //if (_isMoving || _isRotating) return; //左键发射激光 if (Input.GetMouseButtonDown(0)) { //ShootRaser(RaserShooter.position, transform.forward, 0); //StartCoroutine(CorShootRaseLine(RaserShooter.position, transform.forward, 0)); _maxRaserLength = 0.1f; } if (Input.GetMouseButton(0)) { _maxRaserLength = Mathf.Min(LimitMaxRaserLength, _maxRaserLength + LaserSpeed * Time.deltaTime); ShootRaseLine(RaserShooter.position, transform.forward, 0, 0); } else if (Input.GetMouseButtonUp(0)) { DestroyRasers(); } }
public void Set(LaserColor color, int power) { Color = color; Power = power; }
public Laser(LaserColor color, int power) { Color = color; Power = power; }
private static LaserColor Filter(LaserColor color1, LaserColor color2) { return(color1 & color2); }
public static Laser Filter(Laser laser, LaserColor color) { return(new Laser(Filter(laser.Color, color), laser.Power)); }
public Laser Filter(LaserColor color) { Color = Filter(Color, color); return(this); }
private static LaserColor Combine(LaserColor color1, LaserColor color2) { return(color1 | color2); }
public LaserColor Combine(LaserColor otherColor) { return(Color = Combine(Color, otherColor)); }
public void SetState(LaserColor color) { State = color; }
public void FireAt(GameObject owner, Transform gun, Vector3 target, float initialIntensity = Beam.DefaultIntensity, float maxRange = Beam.DefaultMaxRange, LaserColor laserColor = LaserColor.Green) { GameObject go = null; if (laserColor == LaserColor.Green) { go = FindUnusedBeam(greenBeams); } else { go = FindUnusedBeam(orangeBeams); } if (go == null) { Debug.Log("No more objects in pool."); return; } Beam beam = go.GetComponent <Beam>(); beam.ShootAt(owner, target, gun.position, gun.rotation, initialIntensity, maxRange); go.SetActive(true); }
public void FireAt(GameObject owner, Transform gun, Vector3 target, LaserColor laserColor) { FireAt(owner, gun, target, 1.0f, Beam.DefaultMaxRange, laserColor); }