public container(BloodManager bloodManager, GameObject blood) { link = bloodManager; controllManager = GameObject.FindObjectOfType <PlayerController>().controllManager; player = controllManager.container.transform; transform = blood.transform; rigidbody = blood.GetComponent <Rigidbody2D>(); unitHost = controllManager.container.unitHost; widthMin = GeneratorScreenData.SCREEN_WIDTH * 0.1f; widthMax = GeneratorScreenData.SCREEN_WIDTH * 0.9f; heigthMin = GeneratorScreenData.SCREEN_HEIGTH * 0.1f; heigthMax = GeneratorScreenData.SCREEN_HEIGTH * 0.9f; collider = blood.GetComponent <BoxCollider2D>(); bloodBallSpawnPoint = new List <Vector3>(); bloodBallSpawnPoint.Add(new Vector3(2, 2)); bloodBallSpawnPoint.Add(new Vector3(2, 1)); bloodBallSpawnPoint.Add(new Vector3(2, 0)); bloodBallSpawnPoint.Add(new Vector3(1, 3)); bloodBallSpawnPoint.Add(new Vector3(0, 3)); bloodBallSpawnPoint.Add(new Vector3(-1, 3)); bloodBallSpawnPoint.Add(new Vector3(-2, 2)); bloodBallSpawnPoint.Add(new Vector3(-2, 1)); bloodBallSpawnPoint.Add(new Vector3(-2, 0)); }
protected override void DoLayout() { var parentBound = new Rectangle(UnitHost.Location, UnitHost.Size); foreach (var c in Children) { if (c.Disabled) { continue; } var childBound = c.UnitBound; switch (c.Dock) { case Dock.Top: childBound = new Rectangle(parentBound.X, parentBound.Y, parentBound.Width, childBound.Height); parentBound = new Rectangle(parentBound.X, parentBound.Y + childBound.Height, parentBound.Width, parentBound.Height - childBound.Height); break; case Dock.Right: childBound = new Rectangle(parentBound.X + parentBound.Width - childBound.Width, parentBound.Y, childBound.Width, parentBound.Height); parentBound = new Rectangle(parentBound.X, parentBound.Y, parentBound.Width - childBound.Width, parentBound.Height); break; case Dock.Bottom: childBound = new Rectangle(parentBound.X, parentBound.Y + parentBound.Height - childBound.Height, parentBound.Width, childBound.Height); parentBound = new Rectangle(parentBound.X, parentBound.Y, parentBound.Width, parentBound.Height - childBound.Height); break; case Dock.Left: childBound = new Rectangle(parentBound.X, parentBound.Y, childBound.Width, parentBound.Height); parentBound = new Rectangle(parentBound.X + childBound.Width, parentBound.Y, parentBound.Width - childBound.Width, parentBound.Height); break; case Dock.Fill: childBound = parentBound; break; case Dock.None: var position = UnitHost.Location + UnitHost.GetAnchorPoint(c.Anchor) - c.UnitBound.GetAnchorPoint(c.Origine) + c.UnitOffset; childBound = new Rectangle(position, c.UnitBound.Size); break; } c.UnitBound = c.Spacing.Apply(childBound); } }
private void FillGrid() { HostsGrid.DataContext = HostsList; for (int i = 0; i < HostsList.Count; i++) { UnitHost hostCtrl = new UnitHost(HostsList[i]); HostsGrid.Children.Add(hostCtrl); HostsGrid.RowDefinitions.Add(new RowDefinition() { Height = new GridLength(50) }); Grid.SetRow(hostCtrl, i + 1); } }
public virtual void Layout() { var h = new Rectangle(UnitHost.Location, UnitHost.Size); foreach (var c in Childrens) { if (c.Disabled) { continue; } var b = c.UnitBound; switch (c.Dock) { case Dock.Top: b = new Rectangle(h.X, h.Y, h.Width, b.Height); h = new Rectangle(h.X, h.Y + b.Height, h.Width, h.Height - b.Height); break; case Dock.Right: b = new Rectangle(h.X + h.Width - b.Width, h.Y, b.Width, h.Height); h = new Rectangle(h.X, h.Y, h.Width - b.Width, h.Height); break; case Dock.Bottom: b = new Rectangle(h.X, h.Y + h.Height - b.Height, h.Width, b.Height); h = new Rectangle(h.X, h.Y, h.Width, h.Height - b.Height); break; case Dock.Left: b = new Rectangle(h.X, h.Y, b.Width, h.Height); h = new Rectangle(h.X + b.Width, h.Y, h.Width - b.Width, h.Height); break; case Dock.Fill: b = h; break; case Dock.None: var position = UnitHost.Location + UnitHost.GetAnchorPoint(c.Anchor) - c.UnitBound.GetAnchorPoint(c.Origine) + c.UnitOffset; b = new Rectangle(position, c.UnitBound.Size); break; } c.UnitBound = b; } }
void Start() { bloodManager = GameObject.FindObjectOfType <BloodController>().bloodManager; unitHost = bloodManager.container.unitHost; hpBar = GameObject.Find("Hp").GetComponent <RectTransform>(); bloodManager.container.barData = GetComponent <BarDATA>(); mana.Add(new ManaClass()); maxMp = 1; currentMpBar = 0; currentMpBarBack = 0; bloodManager.TryAttack += (args) => { return(Can_MP_DOWN); }; bloodManager.OnAttack += (args) => { return(Mp_Down(1)); }; }
//public GameObject current //public bool isStopSound; public container(SoundManager soundManager, GameObject me) { link = soundManager; unitHost = me.GetComponent <UnitHost>(); activeSound = new List <GameObject>(); }