/// <summary> /// Atualiza referĂȘncia do flex attack /// </summary> /// <returns>Retorna a referĂȘncia do FlexAttack</returns> public FlexAttack updateFlexAttackRef() { GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager"); if (gameManager != null) { flexAttack = gameManager.GetComponent <FlexAttack>(); } return(flexAttack); }
// Use this for initialization void Start() { animator = GetComponentInChildren <Animator>(); GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager"); flexAttack = gameManager.GetComponent <FlexAttack>(); if (flexAttack != null) { flexAttack.addCapivara(this); } }
private void Start() { GameObject gameManager = GameObject.FindGameObjectWithTag("GameManager"); FlexAttack flexAttack = gameManager.GetComponent <FlexAttack>(); if (flexAttack != null) { flexAttack.addExplosive(gameObject); } Rigidbody2D rb2d = GetComponent <Rigidbody2D>(); rb2d.gravityScale = 0; }
private void OnEnable() { flexAttack = attacker.updateFlexAttackRef(); reorderableList = new ReorderableList(flexAttack.attackers, typeof(Attacker), true, true, true, true); // This could be used aswell, but I only advise this your class inherrits from UnityEngine.Object or has a CustomPropertyDrawer // Since you'll find your item using: serializedObject.FindProperty("list").GetArrayElementAtIndex(index).objectReferenceValue // which is a UnityEngine.Object // reorderableList = new ReorderableList(serializedObject, serializedObject.FindProperty("list"), true, true, true, true); // Add listeners to draw events reorderableList.drawHeaderCallback += DrawHeader; reorderableList.drawElementCallback += DrawElement; reorderableList.displayAdd = false; reorderableList.onRemoveCallback += RemoveItem; }