Beispiel #1
0
        // ========================================================================


        protected void OnEnable()
        {
            if (GameData.dataToLoad == null)
            {
                health = 100f;
                Wisp.Heal(this, false);
                DireWolf.Poisoning(this, false);
            }
        }
Beispiel #2
0
 void Start()
 {
     #region References
     playerMove  = GameObject.Find("Player").GetComponent <PlayerMovment>();
     playerStats = GameObject.Find("Player").GetComponent <PlayerStats>();
     wisp        = GameObject.Find("Wisp").GetComponent <Wisp>();
     weapon      = GameObject.Find("Extraction_Rifle").GetComponent <Weapon>();
     enemy       = GameObject.FindGameObjectWithTag("Crab").GetComponent <Enemy>();
     #endregion
 }
Beispiel #3
0
    void InstantiateWisp()
    {
        Vector3 enemyPosition = new Vector3(
            Random.Range(transform.position.x - (spawnRange / 2), transform.position.x + (spawnRange / 2)),
            Random.Range(transform.position.y - (spawnRange / 2), transform.position.y + (spawnRange / 2)),
            transform.position.z
            );
        GameObject enemyObject = Instantiate(Wisp, enemyPosition, Quaternion.identity, transform);
        Wisp       enemyScript = enemyObject.GetComponent <Wisp>();

        enemyScript.Player      = Player;
        enemyScript.Necromancer = gameObject;
        AliveCount++;
    }
Beispiel #4
0
    void Shoot()
    {
        if (ammo <= 0)
        {
            return;
        }

        Anim.SetBool("Attack", true);

        GameObject g = Instantiate(Projectile, new Vector3(transform.position.x, transform.position.y, transform.position.z) + new Vector3(Input.GetAxisRaw("Hor" + ControllerID), -Input.GetAxisRaw("Ver" + ControllerID), 0).normalized * .9f, Quaternion.identity) as GameObject;
        float      y = -Input.GetAxisRaw("Ver" + ControllerID);
        float      x = Input.GetAxisRaw("Hor" + ControllerID);

        if (Input.GetAxisRaw("Hor" + ControllerID) != 0 && -Input.GetAxisRaw("Ver" + ControllerID) != 0)
        {
            g.GetComponent <Rigidbody>().velocity = new Vector3(Input.GetAxisRaw("Hor" + ControllerID), -Input.GetAxisRaw("Ver" + ControllerID), 0).normalized *ProjectileSpeed;
        }
        else
        {
            g.GetComponent <Rigidbody>().velocity = lastAim * ProjectileSpeed;
        }

        float theta = Mathf.Atan(y / x);

        if (x >= 0)
        {
            g.transform.Rotate(0, 0, -90 + theta * 90);
        }
        else
        {
            g.transform.Rotate(0, 0, 90 + theta * 90);
        }

        EmptyObject.transform.LookAt(new Vector3(transform.position.x, transform.position.y, transform.position.z) + new Vector3(Input.GetAxisRaw("Hor" + ControllerID), -Input.GetAxisRaw("Ver" + ControllerID), 0).normalized * 2f);

        g.transform.rotation.Set(EmptyObject.transform.rotation.x, EmptyObject.transform.rotation.y, EmptyObject.transform.rotation.z, EmptyObject.transform.rotation.w);

        //g.transform.LookAt(transform.position + transform.forward * 5);
        Wisp other = (Wisp)g.GetComponent(typeof(Wisp));

        other.setColor(ControllerID);
        other.setNW(NeutrualWisp, Kabbuuum, Hit);
        ammo--;
        UpdateAmmoCount();
    }
Beispiel #5
0
 void Update()
 {
     if (!Wisps.main || didTheThing)
     {
         return;
     }
     if (wisp == WispThings.Hover)
     {
         w = Wisps.main.hover;
     }
     if (wisp == WispThings.Rocket)
     {
         w = Wisps.main.rocket;
     }
     if (wisp == WispThings.Cube)
     {
         w = Wisps.main.cube;
     }
     if (wisp == WispThings.Slowmo)
     {
         w = Wisps.main.slowmo;
     }
     didTheThing = true;
 }
Beispiel #6
0
    public Wisp Clone()
    {
        Wisp clone = (Wisp)this.MemberwiseClone();

        return(clone);
    }
    private async Task UpdateWisps(float time, float deltaTime)
    {
        await new WaitForBackgroundThread();

        for (int i = 0; i < forces.Length; i++)
        {
            Force force = forces[i];
            force.IsIntersecting = false;
            forces[i]            = force;
        }

        // Update wisp forces
        totalHeatTarget = 0;
        for (int i = 0; i < numWisps; i++)
        {
            Wisp w1 = wisps[i];

            for (int forceIndex = 0; forceIndex < forces.Length; forceIndex++)
            {
                Force force            = forces[forceIndex];
                float touchingDist     = force.Radius + w1.Radius;
                float prevPointDistSqr = (w1.Point - force.PrevPoint).sqrMagnitude;
                float pointDistSqr     = (w1.Point - force.Point).sqrMagnitude;
                if (pointDistSqr < (touchingDist * touchingDist) || prevPointDistSqr < (touchingDist * touchingDist))
                {
                    force.IsIntersecting = true;
                    w1.Heat            = Mathf.Clamp01(w1.Heat + (deltaTime * heatGainSpeed));
                    w1.Velocity       -= (force.Velocity * w1.Heat);
                    forces[forceIndex] = force;
                }
            }

            w1.Radius = AddNoise(w1.TargetRadius, ambientNoise, time, i);

            Vector3 point = w1.Point;
            point      += (w1.Velocity * deltaTime);
            w1.Velocity = Vector3.Lerp(w1.Velocity, w1.Velocity * velocityDampen, deltaTime);
            point       = Vector3.Lerp(point, w1.TargetPoint, seekStrength * deltaTime);
            point       = AddNoise(point, NoiseSetting.Lerp(ambientNoise, agitatedNoise, w1.Heat), time, i);
            w1.Point    = point;

            w1.Heat          = Mathf.Clamp01(w1.Heat - (deltaTime * heatDissipateSpeed));
            totalHeatTarget += w1.Heat;

            wisps[i] = w1;
        }

        await Task.Yield();

        // Generate quads
        for (int i = 0; i < numWisps; i++)
        {
            Wisp        wisp = wisps[i];
            Quad        quad = quads[i];
            RenderOrder r    = renderOrder[i];

            wisp.Depth = (wisp.Point - cameraPos).sqrMagnitude;

            Color color = baseWispColor.Evaluate(Mathf.Repeat((time + (i * offsetMultiplier)) * colorCycleSpeed, 1f));
            color += heatWispColor.Evaluate(wisp.Heat);
            color  = Color.Lerp(color, transitionColor, transitionColor.a);

            wisps[i] = wisp;
            int tileNum = wisp.TileOffset + currentTileNum;
            if (tileNum >= numTiles)
            {
                tileNum -= numTiles;
            }

            quad     = Quad.FromWisp(color, wisp.Point, wisp.Radius + (wisp.Heat * heatRadiusMultiplier), cameraUp, cameraRht, tileOffsets[tileNum], tileScale);
            quads[i] = quad;

            r.Index        = i;
            r.Depth        = wisp.Depth;
            renderOrder[i] = r;
        }

        renderOrder.Sort(delegate(RenderOrder r1, RenderOrder r2) { return(r2.Depth.CompareTo(r1.Depth)); });
    }
    public override void Initialize(Vector3 surfacePosition)
    {
        base.Initialize(surfacePosition);

        ISceneTransitionService transitionService;

        if (MixedRealityServiceRegistry.TryGetService <ISceneTransitionService>(out transitionService))
        {
            transitionService.OnTransitionStarted += OnTransitionStarted;
        }

        tileScale   = 1f / numColumns;
        tileOffsets = new Vector2[numTiles];

        int tileNum = 0;

        for (int row = 0; row < numRows; row++)
        {
            for (int column = 0; column < numColumns; column++)
            {
                Vector2 uv = Vector2.zero;
                uv.x = tileScale * column;
                uv.y = (tileScale * -row) - tileScale;
                tileOffsets[tileNum] = uv;

                tileNum++;
                if (tileNum >= numTiles)
                {
                    break;
                }
            }

            if (tileNum >= numTiles)
            {
                break;
            }
        }

        noise = new FastSimplexNoise();

        transitionColor = Color.black;

        forces      = new Force[fingers.Length];
        fingertips  = new Fingertip[fingers.Length];
        wisps       = new Wisp[numWisps];
        quads       = new Quad[numWisps];
        finalQuads  = new Quad[numWisps];
        renderOrder = new List <RenderOrder>(numWisps);

        for (int i = 0; i < numWisps; i++)
        {
            Wisp wisp = new Wisp();
            wisp.TargetPoint  = SurfacePosition + (Random.insideUnitSphere * SurfaceRadius);
            wisp.Point        = wisp.TargetPoint;
            wisp.Velocity     = Random.insideUnitSphere * initialVelocity;
            wisp.TargetRadius = Mathf.Lerp(wispSize.x, wispSize.y, (float)noise.Evaluate(wisp.Point.x, wisp.Point.y, wisp.Point.z));
            wisp.Radius       = wisp.TargetRadius;
            wisp.TileOffset   = Random.Range(0, numTiles);
            wisps[i]          = wisp;

            Quad quad = Quad.FromWisp(baseWispColor.Evaluate(Random.Range(0f, 1f)), wisp.Point, wisp.Radius, Vector3.up, Vector3.right, tileOffsets[wisp.TileOffset], tileScale);
            quad.Color    = transitionColor;
            quads[i]      = quad;
            finalQuads[i] = quads[i];

            RenderOrder r = new RenderOrder();
            renderOrder.Add(r);
        }

        for (int i = 0; i < fingers.Length; i++)
        {
            Transform finger    = fingers[i];
            Fingertip fingertip = fingertips[i];
            fingertip.Block     = new MaterialPropertyBlock();
            fingertip.Trail     = finger.GetComponentInChildren <TrailRenderer>();
            fingertip.Mesh      = finger.GetComponentInChildren <MeshRenderer>();
            fingertip.PingAudio = finger.GetComponentInChildren <AudioSource>();
            fingertips[i]       = fingertip;
        }

        Camera.onPostRender += PostRender;

        updateWisps = true;
        Task task = UpdateWispsTask();
    }
    public IEnumerator NextTurn()
    {
        Debug.Log("Next turn!");
        WhoseTurnIsIt().GetComponent <GameUnit>().Sleep();
        ControlHandler.instance.controlLock = true;

        //If the boss just ended their turn, enter a special minion phase that lasts three seconds.
        if (playerTurn == 1 && MinionCount() > 0)
        {
            CameraMan.instance.ChangeCameraModes(CameraMan.CameraModes.Full);
            WhoseTurnIsIt().GetComponent <Boss> ().RefreshMinionCharges();
            Debug.Log("Special Minion Turn! Minion Count: " + minionsInGame.Count);
            for (int i = 0; i < minionsInGame.Count; i++)
            {
                Minion minion = minionsInGame [i].GetComponent <Minion>();
                minion.WakeUp();
                minion.RefreshMoves();
                minion.HuntAndPester();
                yield return(new WaitForSeconds(1f));
            }
            yield return(new WaitForSeconds(2));

            for (int i = 0; i < minionsInGame.Count; i++)
            {
                Minion minion = minionsInGame [i].GetComponent <Minion>();
                minion.Sleep();
            }
        }
        if (wispsInGame.Count > 0)
        {
            CameraMan.instance.ChangeCameraModes(CameraMan.CameraModes.Full);
            yield return(new WaitForSeconds(1f));

            Debug.Log("Special Wisp Turn! Wisp Count: " + wispsInGame.Count);
            for (int i = 0; i < wispsInGame.Count; i++)
            {
                Wisp wisp = wispsInGame [i].GetComponent <Wisp>();
                wisp.WakeUp();
                wisp.RefreshMoves();
                wisp.ScoutOrReturn();
                yield return(new WaitForSeconds(2.5f));
            }
            yield return(new WaitForSeconds(2));
        }
        CameraMan.instance.ChangeCameraModes(CameraMan.CameraModes.Follow);

        playerTurn++;

        if (playerTurn > 4)
        {
            playerTurn = 1;
        }

        while (!WhoseTurnIsIt().GetComponent <GameUnit> ().isAlive())
        {
            playerTurn++;
        }

        if (playerTurn > 4)
        {
            playerTurn = 1;
        }

        GameUnit playerInControl = WhoseTurnIsIt().GetComponent <GameUnit>();

        if (playerInControl.GetComponent <Player> () != null)
        {
            playerInControl.GetComponent <Player>().RefreshArrows();
        }
        playerInControl.RefreshMoves();
        CameraMan.instance.SetTarget(WhoseTurnIsIt().transform);
        playerInControl.WakeUp();
        GameTileManager.instance.UpdateActiveListBasedOnPlayerPosition(playerInControl);
        MenuController.instance.GetRoundStart().StartNewRound(playerInControl);
        yield return(new WaitForSeconds(0.5f));

        ControlHandler.instance.controlLock = false;
    }
Beispiel #10
0
 protected override void Update()
 {
     base.Update();
     iconHolder.SetActive(hud.player.wispsEnabled);
     width = background.rectTransform.rect.width;
     if (hud.player.UsingWisp && tim < 1)
     {
         tim += Time.deltaTime * 5;
     }
     if ((!hud.player.UsingWisp || !hud.player.wispsEnabled) && tim > 0)
     {
         tim -= Time.deltaTime * 5;
     }
     scaledObject.localScale = Vector3.Lerp(Vector3.zero, originalScale, tim);
     if (hud.player.currWisp != null && hud.player.wispsEnabled)
     {
         Wisp w = hud.player.currWisp;
         if ((w.beingUsed && w.timeLeft > 0) || !w.beingUsed)
         {
             RectTransform r   = bar.rectTransform;
             float         amt = w.timeLeft;
             float         max = w.duration;
             if (w.beingUsed)
             {
                 foreach (ParticleSystem p in particles)
                 {
                     var m = p.main;
                     var e = p.emission;
                     e.enabled    = true;
                     m.startColor = icon.color;
                 }
             }
             else
             {
                 foreach (ParticleSystem p in particles)
                 {
                     var e = p.emission;
                     e.enabled = false;
                 }
             }
             r.sizeDelta = new Vector2(Mathf.Clamp01(amt / max) * width, r.rect.height);
             bar.color   = w.barColor;
             icon.color  = Color.white;
             icon.sprite = w.icon;
         }
         else
         {
             icon.color = Color.clear;
             foreach (ParticleSystem p in particles)
             {
                 var e = p.emission;
                 e.enabled = false;
             }
         }
     }
     else
     {
         icon.color = Color.clear;
         foreach (ParticleSystem p in particles)
         {
             var e = p.emission;
             e.enabled = false;
         }
     }
 }