Esempio n. 1
0
 private void Awake()
 {
     liveBar   = FindObjectOfType <LiveBar>(); //поиск сердец на сцене
     rigidbody = GetComponent <Rigidbody2D>();
     animator  = GetComponent <Animator>();
     sprite    = GetComponentInChildren <SpriteRenderer>();
     ball      = Resources.Load <Ball>("Ball");
 }
Esempio n. 2
0
 protected BGameObject(Texture2D texture, float positionX, float positionY)
 {
     mTexture           = texture;
     Width              = mTexture.Width;
     Height             = mTexture.Height;
     Position           = new Vector2(positionX, positionY);
     TextureOffset      = Vector2.Zero;
     CollisionBoxSize   = new Vector2(1, 1);
     CollisionBoxOffset = new Vector2(0.5f, 0.5f);
     mLiveBar           = new LiveBar();
     mLiveBar.LoadContent();
 }
Esempio n. 3
0
    private void Awake()
    {
        Text      = FindObjectOfType <ScoreText>();
        LivesBar  = FindObjectOfType <LiveBar>();
        Character = GetComponent <Rigidbody2D>();
        Animator  = GetComponent <Animator>();
        Sprite    = GetComponentInChildren <SpriteRenderer>();

        if (OnLandEvent == null)
        {
            OnLandEvent = new UnityEvent();
        }

        if (OnCrouchEvent == null)
        {
            OnCrouchEvent = new BoolEvent();
        }
    }
 public void InsertBar(LiveBar liveBar)
 {
     if (preOpen == 0)
     {
         preOpen         = liveBar.Open;
         preClose        = liveBar.Close;
         this.preBarType = liveBar.AbsoluteRaiseType;
         if (this.preBarType == AbsoluteBarType.Even)
         {
             this.preBarType = AbsoluteBarType.Raise;
         }
         riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Open));
         riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Close));
     }
     else
     {
         if (this.preBarType == AbsoluteBarType.Raise)
         {
             if (liveBar.RelativeRaiseType == BarType.RealRaise || liveBar.RelativeRaiseType == BarType.FakeDecent)
             {
                 riscPointList.Last().Time  = liveBar.BarOpenTime;
                 riscPointList.Last().Price = liveBar.Close;
                 if (liveBar.RelativeRaiseType == BarType.RealRaise)
                 {
                     this.preOpen  = liveBar.Open;
                     this.preClose = liveBar.Close;
                 }
             }
             else if (liveBar.RelativeRaiseType == BarType.RealDecent)
             {
                 if (liveBar.Close >= preOpen)
                 {
                     riscPointList.Last().Time  = liveBar.BarOpenTime;
                     riscPointList.Last().Price = liveBar.Open > preClose ? liveBar.Open : preClose;
                 }
                 else
                 {
                     riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Close));
                     this.preOpen    = liveBar.Open;
                     this.PreClose   = liveBar.Close;
                     this.preBarType = AbsoluteBarType.Decent;
                 }
             }
             else if (liveBar.RelativeRaiseType == BarType.FakeRaise)
             {
                 if (liveBar.Close < preOpen)
                 {
                     riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Close));
                     this.preOpen    = liveBar.Open;
                     this.preClose   = liveBar.Close;
                     this.preBarType = AbsoluteBarType.Decent;
                 }
                 else
                 {
                     riscPointList.Last().Time  = liveBar.BarOpenTime;
                     riscPointList.Last().Price = liveBar.Close;
                 }
             }
             else
             {
                 riscPointList.Last().Time  = liveBar.BarOpenTime;
                 riscPointList.Last().Price = liveBar.Close;
             }
         }
         else if (this.preBarType == AbsoluteBarType.Decent)
         {
             if (liveBar.RelativeRaiseType == BarType.RealDecent || liveBar.RelativeRaiseType == BarType.FakeRaise)
             {
                 riscPointList.Last().Time  = liveBar.BarOpenTime;
                 riscPointList.Last().Price = liveBar.Close;
                 if (liveBar.RelativeRaiseType == BarType.RealDecent)
                 {
                     this.preOpen  = liveBar.Open;
                     this.preClose = liveBar.Close;
                 }
             }
             else if (liveBar.RelativeRaiseType == BarType.FakeDecent)
             {
                 if (liveBar.Close > preClose)
                 {
                     riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Close));
                     this.preOpen    = liveBar.Open;
                     this.preClose   = liveBar.Close;
                     this.preBarType = AbsoluteBarType.Raise;
                 }
                 else
                 {
                     riscPointList.Last().Time  = liveBar.BarOpenTime;
                     riscPointList.Last().Price = liveBar.Close;
                 }
             }
             else if (liveBar.RelativeRaiseType == BarType.RealRaise)
             {
                 if (liveBar.Close > this.preOpen)
                 {
                     riscPointList.Add(new RiscPoint(liveBar.BarOpenTime, liveBar.Close));
                     this.preOpen    = liveBar.Open;
                     this.preClose   = liveBar.Close;
                     this.preBarType = AbsoluteBarType.Raise;
                 }
                 else
                 {
                     riscPointList.Last().Time  = liveBar.BarOpenTime;
                     riscPointList.Last().Price = liveBar.Open > preClose ? preClose : liveBar.Open;
                 }
             }
         }
         else
         {
             riscPointList.Last().Time = liveBar.BarOpenTime;
         }
     }
 }
 public LiveBarArrivalEventArgs(LiveBar bar, int inteval)
 {
     this._bar     = bar;
     this._inteval = inteval;
 }