예제 #1
0
    public void Init(SquadData squadData)
    {
        _squadData = squadData;

        _childrenList = GetComponentsInChildren <Transform>(true);

        squadData.SquadFiller  = _childrenList[1].gameObject;
        squadData.ZoneAttack   = _childrenList[2].gameObject;
        squadData.Highlighting = _childrenList[7].gameObject;
        _effectSmoke           = _childrenList[8].gameObject.GetComponent <ParticleSystem>();

        _squadControlPanelUI = squadData.SquadUI;
        _clickHandler        = squadData.ClickHandler;

        _squadMovement     = gameObject.AddComponent <SquadMovementPlayer>();
        _squadSelected     = gameObject.AddComponent <SquadSelectedPlayer>();
        _squadControlPanel = gameObject.AddComponent <SquadControlPanel>();
        _squadWeapon       = gameObject.AddComponent <SquadWeapon>();
        _damageDisplay     = GetComponent <DamageDisplay>();

        squadData.SquadFiller.GetComponent <SquadFiller>().Init(Color.blue);
        _squadMovement.Init(squadData);
        _squadSelected.Init(squadData);
        _squadControlPanel.Init(squadData);
        _squadWeapon.Init(squadData);
    }
예제 #2
0
    //Creates a new instance of damage text and tells the damage text to display the damage done
    public void DisplayDamageText(Vector3 position, float damageDone)
    {
        GameObject    newDamageText = Instantiate(damageTextPrefab, position, new Quaternion()) as GameObject;
        DamageDisplay damageDisplay = newDamageText.GetComponent <DamageDisplay>();

        damageDisplay.SetDamageValue(damageDone);
    }
예제 #3
0
 public Damage()
 {
     Display = MegaManager.Table.DamageDisplay;
     EventManager.OnAddDamageToPool       += AddDamage;
     EventManager.OnOpponentHealthClicked += DealDamageToOpponent;
     EventManager.Phases.EndOfTurn_OnExit += OnExit_EndOfTurn;
 }
예제 #4
0
    public static DamageDisplay Create(Vector3 pos, int amount, DamageType type)
    {
        GameObject    textDamage = Instantiate(GameManager.Instance.DamageText, pos, Quaternion.identity);
        DamageDisplay damage     = textDamage.GetComponent <DamageDisplay>();

        damage.CustomSetup(amount, type);
        return(damage);
    }
예제 #5
0
 public static void AddInvoker_Battle_ApplyDamage(DamageDisplay displayScript)
 {
     invokers_Battle_ApplyDamage.Add(displayScript);
     //if (listeners_SpeedUpFX != null)
     foreach (UnityAction <int, int?, int?> listener in listeners_Battle_ApplyDamage)
     {
         displayScript.AddListener_Battle_ApplyDamage(listener);
     }
 }
예제 #6
0
 private void Awake()
 {
     UnitStats              = GetComponent <UnitStats>();
     UnitMovement           = GetComponent <UnitMovement>();
     Animator               = GetComponentInChildren <Animator>();
     AnimationDurations     = GetComponentInChildren <AnimationDurations>();
     CharacterActiveEffects = GetComponent <CharacterActiveEffects>();
     ParticleSystems        = GetComponentInChildren <ParticleSystems>();
     DamageDisplay          = GetComponentInChildren <DamageDisplay>();
 }
    public void SpawnText(string text, Color textColor, Transform spawnOn)
    {
        GameObject    GO         = ObjectPool.Spawn(textPrefab, this.transform, Vector3.zero, Quaternion.identity);
        DamageDisplay dmgDisplay = GO.GetComponent <DamageDisplay>();

        dmgDisplay.riseFrom = spawnOn;
        dmgDisplay.Init();
        dmgDisplay.SetText(text, textColor);
        dmgDisplay.started = true;
    }
예제 #8
0
 public virtual void OnCollisionEnter(Collision collision)
 {
     if (collision.transform.CompareTag("Arrow"))
     {
         Transform       arrow       = collision.transform;
         ArrowProjectile arrowScript = arrow.GetComponent <ArrowProjectile>();
         DamageDisplay.Create(transform.position + Vector3.up * 2f, arrowScript.damage, DamageType.CRITICAL);
         agent.Move(collision.transform.forward.normalized * 0.1f);
         //Vector3 result = collision.transform.forward + transform.forward * -1;
         //rb.AddForce(result.normalized * 50f, ForceMode.Impulse);
         //rb.AddExplosionForce(50.0f, collision.transform.GetComponent<ArrowProjectile>().head.position, 2f);
     }
 }
예제 #9
0
    //Function called from AttackAction.PerformAction to show damage dealt to a character at the given tile
    public void DisplayDamageDealt(float timeDelay_, int damage_, DamageType type_, CombatTile3D damagedCharTile_, bool isCrit_, bool isHeal_ = false)
    {
        //If the damage dealt was 0, nothing happens
        if (damage_ <= 0)
        {
            return;
        }

        //Creating an instance of the damage text object prefab
        GameObject newDamageDisplay = GameObject.Instantiate(this.damageTextPrefab.gameObject);

        //Getting the DamageText component reference
        DamageDisplay newDamageText = newDamageDisplay.GetComponent <DamageDisplay>();

        //Setting the info for the text
        newDamageText.SetDamageToDisplay(timeDelay_, damage_, type_, damagedCharTile_.transform.position, isCrit_, isHeal_);

        //Updating the health bars so we can see how much health characters have
        this.uiHandler.UpdateHealthBars();
    }
예제 #10
0
 void Awake()
 {
     //init instance
     instance = this;
 }
예제 #11
0
    private void Start()
    {
        display = owner.GetComponent <DamageDisplay>();

        display.Display(Health);
    }