Ejemplo n.º 1
0
    private IEnumerator DoSpawn(float delay, Action callback, Transform targetTransform)
    {
        yield return new WaitForSeconds(delay);

        if (!_hasSpawned)
        {
            _fighterInst = Instantiate<Fighter>(FighterPrefab);
            _fighterInst.SpawnVehicle(_fighterInst.gameObject, _fighterInst.VehiclePrefab, Universe.Current.GetUniversePosition(transform.position), transform.rotation);
            if (targetTransform != null)
                _fighterInst.SetTarget(targetTransform);
            if (AddWarpEffect)
            {
                _warpEffect = _fighterInst.VehicleInstance.gameObject.AddComponent<WarpEffect>();
                _warpEffect.transform.position = transform.position;
                _warpEffect.transform.forward = transform.forward;

                _warpEffect.WarpEffectPrefab = SpawnEffect;
                _warpEffect.Timeout = 0.4f;
                _warpEffect.Distance = 20f;
            }
            _hasSpawned = true;
            if (callback != null)
                callback();
            if (OnSpawn != null)
                OnSpawn(_fighterInst.gameObject);
        }
    }
Ejemplo n.º 2
0
 public void playWarpAnims()
 {
     StartCoroutine("delayedFireEvent");
     PowerEffect.staticChangeVarValue(costPerJump);
     WarpEffect.changeValuesByOne();
     updateValuesInHUD(new Effect[] { new PowerEffect(), new WarpEffect() });
     warpScript.playWarp();
     resetTimers();
 }
Ejemplo n.º 3
0
    /* Interface / Usage */
    public static void SpawnDistortionRing(float x_pixel, float y_pixel, float strength, float ring_width, float travel_distance, float duration_sec)
    {
        singleton = Camera.main.GetComponent <WarpEffect>();
        if (singleton == null)
        {
            singleton = Camera.main.gameObject.AddComponent <WarpEffect>();
        }

        singleton.distortion_rings.Add(new DistortionRing(x_pixel, y_pixel, strength, ring_width, travel_distance, duration_sec));
    }
Ejemplo n.º 4
0
 void Start()
 {
     effect       = GetComponent <WarpEffect>();
     motherShip   = GameObject.FindGameObjectWithTag("MotherShip").GetComponent <MotherShip>();
     ui           = GameObject.FindGameObjectWithTag("UI").GetComponent <UI>();
     player       = GameObject.FindGameObjectWithTag("Player").GetComponent <PlayerMovement>();
     levelRoot    = GameObject.FindGameObjectWithTag("Level");
     fuelDropSpot = motherShip.FuelDropSpot;
     DisableFuelDropSpot();
 }
Ejemplo n.º 5
0
        public void Warp()
        {
            if (WarpCooldown <= 0)
            {
                CanWarp = true;
            }
            if (!IsDestroyed && CanWarp)
            {
                int    seed      = new Random().Next();
                Random r         = new Random(seed);
                double x         = r.Next((int)Parent.ActualWidth);
                double y         = r.Next((int)Parent.ActualHeight);
                double reappearX = Center.X + x;
                double reappearY = Center.Y + y;
                Effect e1        = new WarpEffect(new Point(Center.X, Center.Y), Brushes.White, Brushes.Black, PlayerColor, 33);
                Effects.Add(e1);
                AddToDisplay(e1);
                if (reappearX > Parent.ActualWidth + 5)
                {
                    reappearX -= Parent.ActualWidth;
                }
                if (reappearX < -5)
                {
                    reappearX += Parent.ActualWidth;
                }
                if (reappearY > Parent.ActualHeight + 5)
                {
                    reappearY -= Parent.ActualHeight;
                }
                if (reappearY < -5)
                {
                    reappearY += Parent.ActualHeight;
                }


                Effect e2 = new WarpEffect(new Point(reappearX, reappearY), Brushes.White, Brushes.Black, PlayerColor, 33);
                Effects.Add(e2);
                AddToDisplay(e2);

                TeleportPoints(new Point(x, y));
                CanWarp      = false;
                CanReappear  = true;
                WarpCooldown = 200;
            }
        }
Ejemplo n.º 6
0
 void SpawnWithClickPosition(int x_pixel, int y_pixel)
 {
     WarpEffect.SpawnDistortionRing(x_pixel, y_pixel, _strength, _radius, _distance, _duration);
 }
Ejemplo n.º 7
0
    void SpawnWithWorldPositionAndStrength(Vector3 pos, float strength)
    {
        Vector3 screen_point = Camera.main.WorldToScreenPoint(pos);

        WarpEffect.SpawnDistortionRing(screen_point.x, screen_point.y, strength, _radius, _distance, _duration);
    }
Ejemplo n.º 8
0
 void _OnClick()
 {
     SceneTransitionController.RequestSceneTransition(destination_scene_name, 2.0f, _SceneTransitionCallback, fade_shape, easing_curve);
     WarpEffect.SpawnDistortionRing(Input.mousePosition.x, Input.mousePosition.y, 5f, 30, 100, 0.5f);
 }