void Start() { CH = CHG.GetComponent <charHealth>(); healthMax = CH._getHealthMax(); health = CH._getHealth(); healthBleck = health; BalanceMax = CH._getBalancehMax(); Balance = CH._getBalance(); BalanceBleck = Balance; ManaMax = CH._getManaMax(); Mana = CH._getMana(); ManaBleck = Mana; HealthBarRenderer = HealthBar.GetComponent <SpriteRenderer>(); HealthBleckBarRenderer = HealthBleckBar.GetComponent <SpriteRenderer>(); HealthBarLenght = HealthBarRenderer.size.x; BalanceBarRenderer = BalanceBar.GetComponent <SpriteRenderer>(); BalanceBleckBarRenderer = BalanceBleckBar.GetComponent <SpriteRenderer>(); BalanceBarLenght = BalanceBarRenderer.size.x; ManaBarRenderer = ManaBar.GetComponent <SpriteRenderer>(); ManaBleckBarRenderer = ManaBleckBar.GetComponent <SpriteRenderer>(); ManaBarLenght = ManaBarRenderer.size.x; ManaPointBarRenderer = ManaPointBar.GetComponent <SpriteRenderer>(); ManaPointBleckBarRenderer = ManaPointBleckBar.GetComponent <SpriteRenderer>(); ManaPointBarLenght = ManaPointBarRenderer.size.x; }
private void OnTriggerExit2D(Collider2D collision) { if (collision.tag == "Char" || collision.tag == "Player") { charHealth CH = collision.transform.GetComponentInParent <charHealth>(); if (CH._getTeam() != team) { CHs.Remove(CH); } } }
void changeTarget() { TargetHelth = Target.GetComponent <charHealth>(); TargetCharMove = Target.GetComponent <charMove>(); TargetFightManager = Target.GetComponent <fightmanager2>(); SelfHelth = GetComponent <charHealth>(); SelfWayPoints = GetComponent <charWayPoints>(); SelfCharMove = GetComponent <charMove>(); SelfFightManager = GetComponent <fightmanager2>(); }
private void OnTriggerEnter2D(Collider2D collision) { if (collision.tag == "Char" || collision.tag == "Player") { charHealth CH = collision.transform.GetComponentInParent <charHealth>(); if (CH._getTeam() != team) { CHs.Add(CH); CH._getAttack(oneDamage[0], oneDamage[1], oneDamage[2]); } } }
void Start() { CH = gameObject.GetComponent <charHealth>(); refreshMaxVar(); dataBaseSprites Base = Camera.main.GetComponent <dataBaseSprites>(); bar = Base.spriteArray[17]; health = Base.spriteArray[18]; balance = Base.spriteArray[19]; healthBarObj = new GameObject(); healthObj = new GameObject(); BalanceObj = new GameObject(); healthBarObj.name = "HealthBar"; healthObj.name = "Health"; BalanceObj.name = "Balance"; barSR = healthBarObj.AddComponent <SpriteRenderer>(); healthSR = healthObj.AddComponent <SpriteRenderer>(); balanceSR = BalanceObj.AddComponent <SpriteRenderer>(); barSR.sprite = bar; healthSR.sprite = health; balanceSR.sprite = balance; healthSR.drawMode = SpriteDrawMode.Tiled; balanceSR.drawMode = SpriteDrawMode.Tiled; healthSR.sortingOrder = 2; balanceSR.sortingOrder = 2; healthBarObj.transform.parent = transform; healthObj.transform.parent = healthBarObj.transform; BalanceObj.transform.parent = healthBarObj.transform; healthBarObj.transform.localPosition = new Vector3(0, 1.3f, 0); healthObj.transform.localPosition = new Vector3(0, 1 / 96f * 1.5f, 0); BalanceObj.transform.localPosition = new Vector3(0, -1 / 96f * 1.5f, 0); MaxHealthSize = healthSR.size.x; MaxBalanceSize = balanceSR.size.x; //ZorderScript ZS = healthBarObj.AddComponent<ZorderScript>(); //ZS.plus = 101; }
void Start() { CH = GetComponent <charHealth>(); attackObject = new GameObject(); AS = attackObject.AddComponent <attackScript>(); attackObject.name = "attack"; attackObject.tag = "Attack"; attackObject.transform.parent = transform; attackObject.transform.localPosition = new Vector2(0, 0); PC = attackObject.AddComponent <PolygonCollider2D>(); PC.isTrigger = true; Rigidbody2D RB2 = attackObject.AddComponent <Rigidbody2D>(); RB2.bodyType = RigidbodyType2D.Kinematic; CSC = attackObject.AddComponent <createSegmentCircle>(); CSC._doCreateZero(PC); }