示例#1
0
    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);
        }
    }
示例#2
0
    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));
    }
示例#3
0
        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);
         }
     }
 }
示例#5
0
        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();
            }
        }
示例#6
0
 public void Set(LaserColor color, int power)
 {
     Color = color;
     Power = power;
 }
示例#7
0
 public Laser(LaserColor color, int power)
 {
     Color = color;
     Power = power;
 }
示例#8
0
 private static LaserColor Filter(LaserColor color1, LaserColor color2)
 {
     return(color1 & color2);
 }
示例#9
0
 public static Laser Filter(Laser laser, LaserColor color)
 {
     return(new Laser(Filter(laser.Color, color), laser.Power));
 }
示例#10
0
 public Laser Filter(LaserColor color)
 {
     Color = Filter(Color, color);
     return(this);
 }
示例#11
0
 private static LaserColor Combine(LaserColor color1, LaserColor color2)
 {
     return(color1 | color2);
 }
示例#12
0
 public LaserColor Combine(LaserColor otherColor)
 {
     return(Color = Combine(Color, otherColor));
 }
示例#13
0
 public void SetState(LaserColor color)
 {
     State = color;
 }
示例#14
0
        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);
        }
示例#15
0
 public void FireAt(GameObject owner, Transform gun, Vector3 target, LaserColor laserColor)
 {
     FireAt(owner, gun, target, 1.0f, Beam.DefaultMaxRange, laserColor);
 }