Exemplo n.º 1
0
 private void OnCook(ESide side, float value)
 {
     if (value > CurrentRecipe.MaxFry)
     {
         LoseEvent?.Invoke();
     }
 }
Exemplo n.º 2
0
        IList <QuadTreeNode <T> > Children(ESide direction)
        {
            IList <QuadTreeNode <T> > children = new List <QuadTreeNode <T> >();

            Children(direction, children);
            return(children);
        }
Exemplo n.º 3
0
 private void UpdateBar(ESide currentSide, float value)
 {
     if (Side == currentSide)
     {
         Bar.fillAmount = value;
     }
 }
Exemplo n.º 4
0
    public void Attach(Vector3 pos, float size, ESide side)
    {
        switch (side)
        {
        case ESide.LEFT:
            cached_scale    = new Vector3(1, size / height);
            cached_position = pos - new Vector3(width, 0);
            break;

        case ESide.RIGHT:
            cached_position = pos + new Vector3(width, 0);
            cached_scale    = new Vector3(1, size / height);
            break;

        case ESide.UP:
            cached_position = pos + new Vector3(0, height);
            cached_scale    = new Vector3(size / width, 1);
            break;

        case ESide.DOWN:
            cached_position = pos - new Vector3(0, height);
            cached_scale    = new Vector3(size / width, 1);
            break;
        }
    }
Exemplo n.º 5
0
        public override void Collided(BaseUnit baseUnit)
        {
            if (baseUnit.UnitType != UnitType.Wall)
            {
                return;
            }

            ESide side = CollisionChecker.GetCollisionSide(this, _lastPosition, baseUnit);

            switch (side)
            {
            case ESide.Left:
                Position = new Point(baseUnit.Position.X - Width, Position.Y);
                break;

            case ESide.Right:
                Position = new Point(baseUnit.Position.X + baseUnit.Width, Position.Y);
                break;
            }

            if (baseUnit.UnitType == UnitType.Bonus)
            {
                //Width = Width * 2;
            }
        }
Exemplo n.º 6
0
        /// <summary>
        /// Sets the new primary sensor for the manifold on the given side. If a manifold already exists, then it will
        /// be replaced by a new manifold.
        /// </summary>
        /// <returns><c>true</c>, if primary manifold was set, <c>false</c> otherwise.</returns>
        /// <param name="side">Side.</param>
        /// <param name="sensor">Sensor.</param>
        public bool SetManifold(ESide side, Sensor sensor)
        {
            var index = IndexOfSensor(sensor);

            if (index < 0)
            {
                // The sensor is not in the analyzer.
                return(false);
            }

            switch (side)
            {
            case ESide.Low:
                RemoveManifold(ESide.Low);
                lowSideSensor = sensor;
                NotifyOfAnalyzerEvent(new AnalyzerEvent(AnalyzerEvent.EType.ManifoldAdded, ESide.Low));
                return(true);

            case ESide.High:
                RemoveManifold(ESide.High);
                highSideSensor = sensor;
                NotifyOfAnalyzerEvent(new AnalyzerEvent(AnalyzerEvent.EType.ManifoldAdded, ESide.High));
                return(true);

            default:
                //throw new Exception("Cannot set primary manifold: unknown side: " + side);
                return(false);
            }
        }
Exemplo n.º 7
0
    private void InstantiateSpawnBonus(ESide side_in)
    {
        var go = Instantiate(bonusSpawnPrefab) as GameObject;

        go.transform.SetParent(this.transform);

        var imageRef = go.GetComponent <Image>();

        switch (side_in)
        {
        case ESide.Blue:
            imageRef.color = new Color(0.1f, 0.1f, 0.75f);
            break;

        case ESide.Green:
            imageRef.color = new Color(0.1f, 0.75f, 0.1f);
            break;

        case ESide.Orange:
            imageRef.color = new Color(255, 140, 0);
            break;

        case ESide.Purple:
            imageRef.color = new Color(144, 0, 255);
            break;

        case ESide.Red:
            imageRef.color = new Color(0.75f, 0.1f, 0.1f);
            break;

        case ESide.Yellow:
            imageRef.color = Color.yellow;
            break;
        }
    }
Exemplo n.º 8
0
    public static ESide SlotToSide(int slotServer)
    {
        if (YourController == null)
        {
            return((ESide)slotServer);
        }
        ESide Side = ESide.Slot_0;

        if (YourController.slotServer == 0 || YourController.slotServer >= 4)
        {
            Side = (ESide)slotServer;
        }
        else if (YourController.slotServer == 1)
        {
            if (slotServer == 0)
            {
                Side = ESide.Slot_3;
            }
            else if (slotServer == 2)
            {
                Side = ESide.Slot_1;
            }
            else if (slotServer == 3)
            {
                Side = ESide.Slot_2;
            }
        }
        else if (YourController.slotServer == 2)
        {
            if (slotServer == 0)
            {
                Side = ESide.Slot_2;
            }
            else if (slotServer == 1)
            {
                Side = ESide.Slot_3;
            }
            else if (slotServer == 3)
            {
                Side = ESide.Slot_1;
            }
        }
        else if (YourController.slotServer == 3)
        {
            if (slotServer == 0)
            {
                Side = ESide.Slot_1;
            }
            else if (slotServer == 1)
            {
                Side = ESide.Slot_2;
            }
            else if (slotServer == 2)
            {
                Side = ESide.Slot_3;
            }
        }
        return(Side);
    }
Exemplo n.º 9
0
 public void SetVelocity(Vector2 dir, float force, ESide side)
 {
     if (m_ballInstance != null)
     {
         m_needOffset = side == m_side;
         m_ballInstance.SetVelocity(dir, force);
     }
 }
Exemplo n.º 10
0
    public void AssignSide(ESide side)
    {
        if (side == ESide.Neutral)
        {
            throw new ArgumentException("Side tile can not be neutral");
        }

        tileSide = side;
        destructionIgnoreSides = new [] { side };
        movementIgnoreSides    = ((ESide[])Enum.GetValues(typeof(ESide)))
                                 .Where(val => val != tileSide && val != ESide.Neutral)
                                 .ToArray();

        switch (side)
        {
        case ESide.Blue:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = new Color(0.1f, 0.1f, 0.75f);
            }
            break;

        case ESide.Green:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = new Color(0.1f, 0.75f, 0.1f);
            }
            break;

        case ESide.Orange:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = new Color(255, 140, 0);
            }
            break;

        case ESide.Purple:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = new Color(144, 0, 255);
            }
            break;

        case ESide.Red:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = new Color(0.75f, 0.1f, 0.1f);
            }
            break;

        case ESide.Yellow:
            foreach (var renderer in _renderers)
            {
                renderer.material.color = Color.yellow;
            }
            break;
        }
    }
Exemplo n.º 11
0
    public void SetSideNumber(ESide sidePos, float number)
    {
        var side = GetSide(sidePos);

        if (side != null)
        {
            SetTextureSide(side.FaceRenderer, number);
        }
    }
Exemplo n.º 12
0
    /// <summary>
    /// Thông báo bắt đầu xoay bài (nêu rõ là sẽ quay đến vị trí nào)
    /// </summary>
    /// <param name="sideEnd">Vị trí muốn đến</param>
    public void StartRotate(ESide sideEnd)
    {
        isEnableRotate = true;
        this.sideEnd   = sideEnd;
        toPotision     = GetListRotation.Find(d => d.sideStart == sideEnd).transform.localPosition;
        speedDealCard  = 200f;

        isComplete = this.sideStart == this.sideEnd ? true : false;
    }
Exemplo n.º 13
0
 public void ChangeEffectDir(ESide side)
 {
     if (m_start && m_side == side)
     {
         float value = UnityEngine.Random.Range(0f, 1f);
         m_offsetDir = (value >= 0.5f) ? new Vector2(0.02f, 0f) : new Vector2(-0.02f, 0f);
         m_ballInstance.SetOffsetDir(m_offsetDir);
     }
 }
Exemplo n.º 14
0
        public static void Extends(ref RectBounds rect, ESide side)
        {
            int top    = ((int)side >> 0) & 1; // north
            int right  = ((int)side >> 1) & 1; // east
            int bottom = ((int)side >> 2) & 1; // south
            int left   = ((int)side >> 3) & 1; // west

            rect.Extend(top, right, bottom, left);
        }
Exemplo n.º 15
0
    public void     EnableSide(ESide sidePos, bool enable)
    {
        var side = GetSide(sidePos);

        if (side != null)
        {
            side.FaceRenderer.gameObject.SetActive(enable);
        }
    }
Exemplo n.º 16
0
    private void HitBallDelegate(Player player, Vector2 direction, float force, int id)
    {
        if (m_gameBall == null)
        {
            return;
        }

        bool checkIsHitArea = PlayerCollider.CheckInHitBallArea(m_gameBall.GetBallInstance().transform, player.Transform,
                                                                player.PlayerData.m_radius, player.PlayerData.m_angle, player.BoxCollider);

        if (checkIsHitArea)
        {
            CameraControl.GetInstance().Trigger();
            CameraControl.GetInstance().TriggerMask();

            GameAudioModuel audioModuel = GameStart.GetInstance().AudioModuel;
            if (id == m_player.ID)
            {
                GameEventModuel meoduel = GameStart.GetInstance().EventModuel;
                meoduel.SendEvent(GameEventID.PLAYER_HIT_BALL, true, 0f);

                m_side = ESide.Player;
                m_contestData.AddIndex();

                m_contestUI.FreshUI(m_contestData.m_heart, m_contestData.m_index);
                if (m_contestData != null && m_contestData.m_changeAudio && !m_change)
                {
                    List <string> list = new List <string>
                    {
                        "lerp",
                        "BGM_002",
                    };
                    audioModuel.PlayBgAudio(list);
                    m_change = true;
                }

                m_playerIndex++;
                m_playerIndex = Mathf.Clamp(m_playerIndex, 0, m_audioNameList.Count - 1);
                audioModuel.PlayAudio(m_audioNameList[m_playerIndex]);
            }
            else
            {
                m_side = ESide.AI;
                m_aiIndex++;
                m_aiIndex = Mathf.Clamp(m_aiIndex, 0, m_audioNameList.Count - 1);
                audioModuel.PlayAudio(m_audioNameList[m_aiIndex]);
            }

            if (m_gameBall != null)
            {
                ESide side = (id == m_player.ID) ? ESide.Player : ESide.AI;
                m_gameBall.SetVelocity(direction, force, side);
                m_gameBall.ChangeEffectDir(side);
            }
        }
    }
Exemplo n.º 17
0
        /// <summary>
        /// Queries whether or not the sensor is on the given side of the analyzer.
        /// </summary>
        /// <returns><c>true</c>, if sensor on side was ised, <c>false</c> otherwise.</returns>
        /// <param name="sensor">Sensor.</param>
        /// <param name="side">Side.</param>
        public bool IsSensorOnSide(Sensor sensor, ESide side)
        {
            if (!HasSensor(sensor))
            {
                return(false);
            }

            ESide actual;

            return(GetSideOfSensor(sensor, out actual) && actual == side);
        }
Exemplo n.º 18
0
 private Side GetSide(ESide sidePos)
 {
     foreach (var side in Sides)
     {
         if (side.SidePos == sidePos)
         {
             return(side);
         }
     }
     return(null);
 }
Exemplo n.º 19
0
 public void ExcuteEffect(EffectBase effect, ESide side)
 {
     if (effect != null && effect is EffectBananaBall)
     {
         EffectBananaBall effectBananaBall = effect as EffectBananaBall;
         m_start   = true;
         m_endTime = effectBananaBall.m_duringTime + Time.time;
         m_side    = side;
         ChangeEffectDir(m_side);
     }
 }
Exemplo n.º 20
0
    public Vector3 GetFireBallPoint(ESide seriveSide)
    {
        switch (seriveSide)
        {
        case ESide.Player:
            return(m_userFireBallPoint);

        case ESide.AI:
            return(m_aiFireBallPoint);
        }
        return(Vector3.zero);
    }
Exemplo n.º 21
0
 public void PlayEffect(EffectBase effect, ESide side)
 {
     if (effect != null && effect.m_effectType == EEffectType.InkEffect)
     {
         m_start   = true;
         m_endTime = effect.m_duringTime + Time.time;
         if (m_ink != null && (side == ESide.AI))
         {
             m_ink.SetActive(true);
         }
     }
 }
Exemplo n.º 22
0
        /// <summary>
        /// Queries the next empty sensor index of the given side of the analyzer. If the given side of the analyzer is
        /// full, then -1 will be returned.
        /// </summary>
        /// <returns>The empty sensor index.</returns>
        /// <param name="side">Side.</param>
        public int NextEmptySensorIndex(ESide side)
        {
            var end = (ESide.Low == side) ? 0 : sensorsPerSide;

            for (int i = 0; i < sensorsPerSide; i++)
            {
                if (sensors[i + end] == null)
                {
                    return(i + end);
                }
            }

            return(-1);
        }
Exemplo n.º 23
0
        QuadTreeNode <T> Neighbour(ESide direction, EQuadrant corner)
        {
            QuadTreeNode <T> quadnode = Neighbour(direction);

            if (quadnode == null)
            {
                return(null);
            }
            while (!quadnode.IsLeaf())
            {
                quadnode = quadnode.Child(Reflect(direction, corner));
            }
            return(quadnode);
        }
        private static double _getAngle(double currentAngle, ESide side)
        {
            switch (side)
            {
            case ESide.Left:
            case ESide.Right:
                return(Math.PI - currentAngle);

            case ESide.Bottom:
            case ESide.Top:
                return(-currentAngle);
            }

            return(0);
        }
Exemplo n.º 25
0
        /// <summary>
        /// Remove manifold at the given side form the analyzer.
        /// </summary>
        /// <returns><c>true</c>, if manifold was removed, <c>false</c> otherwise.</returns>
        /// <param name="side">Side.</param>
        public void RemoveManifold(ESide side)
        {
            switch (side)
            {
            case ESide.Low:
                lowSideSensor = null;
                NotifyOfAnalyzerEvent(new AnalyzerEvent(AnalyzerEvent.EType.ManifoldRemoved, ESide.Low));
                break;

            case ESide.High:
                highSideSensor = null;
                NotifyOfAnalyzerEvent(new AnalyzerEvent(AnalyzerEvent.EType.ManifoldRemoved, ESide.High));
                break;
            }
        }
Exemplo n.º 26
0
        /// <summary>
        /// Queries the opposite side of the given side.
        /// </summary>
        /// <returns>The opposite side of.</returns>
        /// <param name="side">Side.</param>
        public ESide GetOppositeSideOf(ESide side)
        {
            switch (side)
            {
            case ESide.Low:
                return(ESide.High);

            case ESide.High:
                return(ESide.Low);

            default:
                Log.E(this, "Cannot get opposite side for side: " + side);
                return(ESide.Low);
                //throw new Exception("Cannot get opposite side for side: " + side);
            }
        }
Exemplo n.º 27
0
        /// <summary>
        /// Queries the fluid state based on the side of the analyzer.
        /// </summary>
        /// <returns>The as fluid state.</returns>
        /// <param name="side">Side.</param>
        public Fluid.EState SideAsFluidState(ESide side)
        {
            switch (side)
            {
            case ESide.Low:
                return(Fluid.EState.Dew);

            case ESide.High:
                return(Fluid.EState.Bubble);

            default:
                Log.E(this, "Cannot get fluid state from side: " + side);
                return(Fluid.EState.Dew);
                //throw new Exception("Cannot get fluid state from side: " + side);
            }
        }
Exemplo n.º 28
0
        /// <summary>
        /// Queries the number of sensors that are in the given side of the analyzer
        /// </summary>
        /// <returns>The sensors in side count.</returns>
        /// <param name="side">Side.</param>
        public int GetSensorsInSideCount(ESide side)
        {
            var i = (ESide.Low == side) ? 0 : sensorsPerSide;

            var ret = 0;

            for (int j = 0; j < sensorsPerSide; j++)
            {
                if (sensors[i++] != null)
                {
                    ret++;
                }
            }

            return(ret);
        }
Exemplo n.º 29
0
        void Neighbours(ESide direction, IList <QuadTreeNode <T> > neighbours)
        {
            QuadTreeNode <T> quadnode = Neighbour(direction);

            if (quadnode != null)
            {
                if (quadnode.IsLeaf())
                {
                    neighbours.Add(quadnode);
                }
                else
                {
                    quadnode.Children(Opposite(direction), neighbours);
                }
            }
        }
        private static Rect GetRectFor(Listing_Standard ls, ESide side, float rowHeight)
        {
            switch (side)
            {
            case ESide.LeftHalf:
                return(ls.GetRect(rowHeight).LeftHalf());

            case ESide.RightHalf:
                return(ls.GetRect(rowHeight).RightHalf());

            case ESide.BothSides:
                return(ls.GetRect(rowHeight));

            default:
                throw new ArgumentException("Unexpected value", nameof(side));
            }
        }