コード例 #1
0
ファイル: ChiBallBreath.cs プロジェクト: leweyg/vrbiofield
 void UpdateParticles_GeneralChi(ParticleSpan ps, float toffset)
 {
     for (int i = 0; i < ps.Count; i++)
     {
         float ba      = this.Breath.UnitBreathInPct;
         float fi      = ((float)i) / ((float)(ps.Count - 1));
         float mt      = Mathf.Repeat(fi + toffset, 1.0f);
         float a       = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f);
         var   pos     = ps.Line.SampleAtUnitLength(mt);
         bool  isSpine = false;
         var   clr     = Color.green;
         if (this.IsInfoAvatar)
         {
             if (ps == this.ClosestInfoSpan)
             {
                 // leave alpha as is
             }
             else
             {
                 a = 0.0f;
             }
         }
         ps.LatestOverallAlpha = a;
         var pi = ps.IndexOf(i);
         this.Particles [pi].position   = pos;
         this.Particles [pi].startColor = ColorWithAlpha(clr, a);
     }
 }
コード例 #2
0
ファイル: Breath.cs プロジェクト: RistoPaasivirta/IOX
    public List <Breath> GetNearbyBreaths(Vec2I pos, int extend)
    {
        List <Breath> list = new List <Breath>();

        if (extend == 0)
        {
            Breath b = GetBreath(pos);
            if (b != null)
            {
                list.Add(b);
            }

            return(list);
        }

        foreach (Vec2I n in Vec2I.Neighbors(pos + new Vec2I(maxDistance, maxDistance)))
        {
            if (Valid(n))
            {
                if (exist[n.x, n.y])
                {
                    list.Add(new Breath(n, parent[n.x, n.y], travelCost[n.x, n.y], steps[n.x, n.y]));
                }
            }
        }

        return(list);
    }
コード例 #3
0
 private static void Postfix(Breath __instance)
 {
     __instance.m_ColdBreathTempThreshold     = -float.MaxValue;
     __instance.m_VeryColdBreathTempThreshold = -float.MaxValue;
     __instance.m_FreezingBreathTempThreshold = -float.MaxValue;
     __instance.StopBreathEffectImmediate();
 }
    private bool MoveTowardsBreath()
    {
        Breath b = GameManager.Instance.Player[0].playerBreath.GetBreath(owner.cell);

        if (b == null)
        {
            return(false);
        }
        if (b.direction == 0)
        {
            return(false);
        }

        Vec2I d      = Vec2I.directions[b.direction];
        Vec2I target = owner.cell + d;

        if (AI.GetHeat(target).x >= 1f)
        {
            return(false);
        }

        if (AI.HasLedge(owner.cell, target))
        {
            return(false);
        }

        wantDirection = new Vector3(d.x, 0, d.y).normalized;
        wantMove      = true;

        return(true);
    }
コード例 #5
0
ファイル: DisableBreathEffect.cs プロジェクト: APXOH/MiniMods
    public static bool Prefix(Breath __instance)
    {
        bool suppress = (bool)AccessTools.Method(typeof(Breath), "ShouldSuppressBreathEffect").Invoke(__instance, new object[0]);

        if (suppress)
        {
            return(false);
        }

        HeavyBreathingState heavyBreathingState = GameManager.GetFatigueComponent().GetHeavyBreathingState();

        if (heavyBreathingState == HeavyBreathingState.Light)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHELOWINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        else if (heavyBreathingState == HeavyBreathingState.Medium)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHMEDIUMINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        else if (heavyBreathingState == HeavyBreathingState.Heavy)
        {
            GameAudioManager.PlaySound(AK.EVENTS.PLAY_VOBREATHHIGHINTENSITYNOLOOP, GameManager.GetPlayerObject());
        }
        return(false);
    }
コード例 #6
0
 /// <summary>
 /// Handles the character being loaded.
 /// </summary>
 /// <param name="sender">Sender.</param>
 /// <param name="e">Event args.</param>
 virtual protected void HandleCharacterLoaded(object sender, CharacterEventArgs e)
 {
     breath = e.Character.GetComponentInChildren <Breath>();
     if (breath == null)
     {
         Debug.LogWarning("The loaded character doesn't have a Breath component.");
     }
 }
コード例 #7
0
    void OnTriggerStay2D(Collider2D other)
    {
        if (waterMass > 0.0f)
        {
            switch (other.tag)
            {
            case "Player":
                Moving movingComponent = other.gameObject.GetComponent <Moving> ();
                Breath breathComponent = other.gameObject.GetComponent <Breath> ();

                if (waterMass > slowingWaterMassCap)
                {
                    if (movingComponent)
                    {
                    }

                    if (waterMass > drowningWaterMassCap)
                    {
                        if (breathComponent)
                        {
                            breathComponent.SetUnderWater();
                        }
                    }
                }

                break;

            case "Sandbag":
                FillWithWater sandbagComponent = other.GetComponent <FillWithWater>();

                if (sandbagComponent)
                {
                    if (parentWaterField)
                    {
                        sandbagComponent.Fill(parentWaterField.RemoveWaterFromWaterTile(posX, posY));
                    }
                    else
                    {
                        Debug.LogError("No parentWaterField assigned to TWaterTile.");
                    }
                }
                else
                {
                    Debug.LogError("Sandbag has no FillWithWater script attached.");
                }

                break;
            }
        }
    }
コード例 #8
0
        public DataBreath(Breath breath)
        {
            InspirationY = breath.Inspiration;
            for (int i = 0; i < InspirationY.Count; i++)
            {
                InspirationX.Add(i * 0.01);
            }
            ExpirationY = breath.Expiration;
            for (int i = 0; i < ExpirationY.Count; i++)
            {
                ExpirationX.Add((i + InspirationY.Count) * 0.01);
            }


            BreathingFrequenceValue = breath.BreathingFrequenceValue;
            Volume              = breath.Volume;
            Coefficient         = breath.Coefficient;
            LoopVolumeFlowValue = breath.LoopVolumeFlowValue;
            Pressure            = breath.Pressure;
        }
コード例 #9
0
    void UpdateParticles_Spinal()
    {
        float toffset = 0;         //UnitAnimationSpeed * Time.time * (1.0f / this.Particles.Length);
        bool  isOut   = (this.Breath.BreathIndex % 2) == 1;
        var   sp      = this.CoreSpan;

        for (int i = 0; i < sp.Count; i++)
        {
            float t = this.Breath.UnitTimeInBreath;
            if (isOut)
            {
                t = (1.0f - t);
            }
            var pos = this.CoreSpan.Line.SampleAtUnitLength(Mathf.Repeat(t + toffset, 1.0f));
            var a   = Mathf.Clamp01(Breath.UnitTo010f(t) * 3.1f);
            var clr = ((!isOut) ? Color.blue : Color.red);
            this.Particles [i].position   = pos;
            this.Particles [i].startColor = ColorWithAlpha(clr, a);
        }
    }
コード例 #10
0
ファイル: ChiBallBreath.cs プロジェクト: leweyg/vrbiofield
    void UpdateParticles_HandToHandSpan(ParticleSpan ps, float toffset)
    {
        var offsets = ps.EnsureRandomOffsets();

        for (int i = 0; i < ps.Count; i++)
        {
            float bt = this.Breath.UnitTimeInBreath;
            float ba = this.Breath.UnitBreathInPct;
            float fi = ((float)i) / ((float)(ps.Count - 1));
            float mt = Mathf.Repeat(fi + toffset, 1.0f);
            float a  = ba * Mathf.Clamp01(Breath.UnitTo010f(mt) * 5.1f);


            var basePose = ps.Line.SampleAtLength(Mathf.Clamp01((bt - 0.5f) * 2.0f));
            var pos      = basePose + (offsets[i] * SphereRadius
                                       * Breath.UnitTo010f(bt)
                                       * Mathf.Sin(Time.timeSinceLevelLoad * 4.2f + (offsets[i].y * 20)));
            bool isSpine = false;
            var  clr     = Color.green;
            if (this.IsInfoAvatar)
            {
                if (ps == this.ClosestInfoSpan)
                {
                    // leave alpha as is
                }
                else
                {
                    a = 0.0f;
                }
            }
            ps.LatestOverallAlpha = a;

            var pi = ps.IndexOf(i);
            this.Particles [pi].position    = pos;
            this.Particles [pi].startColor  = ColorWithAlpha(clr, a);
            this.Particles [pi].startSize3D = Vector3.one * (DefaultRadius * 2.0f);
        }
    }
コード例 #11
0
    public void CastNoise(int range)
    {
        foreach (ThingController monster in breathMonsters)
        {
            Breath b = playerBreath.GetBreath(monster.cell);
            if (b == null) //can happen when shooting while moving (very rare)
            {
                continue;
            }

            if (b.distance > range)
            {
                continue;
            }

            if (monster.CurrentBehavior == null)
            {
                continue;
            }

            monster.CurrentBehavior.AlertByNoise();
        }
    }
コード例 #12
0
 virtual protected void Init()
 {
     barImage = GetComponent <Image> ();
     if (breath == null)
     {
         // No health assigned try to find one
         if (breath == null)
         {
             characterLoader = CharacterLoader.GetCharacterLoader();
         }
         if (characterLoader != null)
         {
             characterLoader.CharacterLoaded += HandleCharacterLoaded;
         }
         else
         {
             breath = GameObject.FindObjectOfType <Breath> ();
             if (breath == null)
             {
                 Debug.LogWarning("Couldn't find a Breath!");
             }
         }
     }
 }
コード例 #13
0
 void Awake()
 {
     g_Breath       = GameObject.Find("Breath");
     g_BreathScript = g_Breath.GetComponent <Breath>();
     g_Breath.SetActive(false);
 }
コード例 #14
0
ファイル: InputManager.cs プロジェクト: DinossourGames/BREATH
        private void DeviceOnReport(DS4Device sender, EventArgs args)
        {
            _isAlive = !sender.IsRemoved;
            var state         = sender.getCurrentState();
            var previousState = sender.getPreviousState();


            var current = state.GetType().GetFields().Where(field => field.FieldType == typeof(bool))
                          .ToDictionary(field => field.Name, field => (bool)field.GetValue(state));

            var previous = state.GetType().GetFields().Where(field => field.FieldType == typeof(bool))
                           .ToDictionary(field => field.Name, field => (bool)field.GetValue(previousState));

            var activeCurrent  = current.Where(val => val.Value).ToDictionary(i => i.Key, i => i.Value);
            var activePrevious = previous.Where(val => val.Value).ToDictionary(i => i.Key, i => i.Value);

            var inativeCurrent   = current.Where(val => !val.Value).ToDictionary(i => i.Key, i => i.Value);
            var inactivePrevious = previous.Where(val => !val.Value).ToDictionary(i => i.Key, i => i.Value);

            var l3  = GetNormalized(state.LX, state.LY);
            var l3P = GetNormalized(previousState.LX, previousState.LY);


            Move?.Invoke(l3);


            if (state.L2Btn || state.R2Btn)
            {
                Breath?.Invoke(new Vector2(state.L2, state.R2));
            }
            else
            {
                BreathRelease?.Invoke();
            }

            //Move Up
            if (l3.Y > .5f)
            {
                if (l3P.Y < .5 && l3P.Y > 0)
                {
                    Next?.Invoke();
                }
            }
            //Move Down
            if (l3.Y < -.5)
            {
                if (l3P.Y > -.5)
                {
                    Previous?.Invoke();
                }
            }

            OnButtonPressedEvent(sender, state);

            foreach (var c in activeCurrent.Where(c => !activePrevious.ContainsKey(c.Key)))
            {
                if (CanReceiveInput)
                {
                    OnOnButtonClickEvent(sender, state, c.Key);
                }
            }

            foreach (var c in inativeCurrent.Where(c => activePrevious.ContainsKey(c.Key)))
            {
                if (CanReceiveInput)
                {
                    OnReleaseClickEvent(sender, state, c.Key);
                }
            }
        }
コード例 #15
0
ファイル: InputManager.cs プロジェクト: DinossourGames/BREATH
        void Update()
        {
            if (_isAlive)
            {
                return;
            }

            var move = new Vector2(0, 0);

            if (_input.KeyPressed(Key.W))
            {
                move.Y = 1;
            }
            if (_input.KeyPressed(Key.S))
            {
                move.Y = -1;
            }
            if (_input.KeyPressed(Key.D))
            {
                move.X = 1;
            }
            if (_input.KeyPressed(Key.A))
            {
                move.X = -1;
            }
            Move?.Invoke(move);


            var breath = new Vector2(0, 0);

            if (_input.KeyPressed(Key.LShift))
            {
                breath.X = 1;
            }
            if (_input.KeyPressed(Key.RShift))
            {
                breath.Y = 1;
            }
            Breath?.Invoke(breath);

            if (_input.KeyPressed(Key.Space))
            {
                Jump?.Invoke();
            }
            if (_input.KeyDown(Key.J))
            {
                Attack?.Invoke();
            }
            if (_input.KeyPressed(Key.F))
            {
                Interact?.Invoke();
            }

            if (_input.KeyPressed(Key.Down))
            {
                Previous?.Invoke();
            }
            if (_input.KeyPressed(Key.Up))
            {
                Next?.Invoke();
            }

            if (_input.KeyPressed(Key.Escape))
            {
                CallAction(Menu, "Menu");
            }
            if (_input.KeyPressed(Key.P))
            {
                CallAction(Pause, "Pause");
            }
            if (_input.KeyPressed(Key.Return))
            {
                CallAction(Select, "Select");
            }
        }