Пример #1
0
    void SpawnProjectileAbility(string projectileName, Vector3 position, Quaternion rotation, Vector3 direction, int layer, int casterPlayerID)
    {
        ProjectileVisuals projectile = AbilityProjectilePool.Instance.GetProjectile(projectileName);

        projectile.transform.position = position;
        projectile.transform.rotation = rotation;
        Debug.Log("AbilitySpawner SpawnProjectileAbility position " + position);

        projectile.gameObject.layer = layer;

        projectile.Activate();

        MoveAbility movement = projectile.GetComponent <MoveAbility>();

        if (movement != null)
        {
            movement.SetDirection(direction);
        }

        Player          player          = PlayerManager.Instance.GetPlayer(casterPlayerID);
        AbilityCollider abilityCollider = projectile.GetComponent <AbilityCollider>();

        abilityCollider.SetCasterID(casterPlayerID);

        if (player.hasDoubleDamage)
        {
            abilityCollider.ActivateDoubleDamageEffect(player.hasDoubleDamage);
        }
    }
Пример #2
0
    void SpawnStaticAbility(string projectileName, Vector3 position, Quaternion rotation, int layer, int casterPlayerID)
    {
        Debug.Log("AbilitySpawner Spawning " + projectileName);

        ProjectileVisuals spawned = AbilityProjectilePool.Instance.GetProjectile(projectileName);

        spawned.transform.position = position;
        spawned.transform.rotation = rotation;
        spawned.Activate();

        spawned.gameObject.layer = layer;

        Player          player          = PlayerManager.Instance.GetPlayer(casterPlayerID);
        AbilityCollider abilityCollider = spawned.GetComponent <AbilityCollider>();

        if (abilityCollider)
        {
            abilityCollider.SetCasterID(casterPlayerID);
        }

        if (player.hasDoubleDamage)
        {
            abilityCollider.ActivateDoubleDamageEffect(player.hasDoubleDamage);
        }
    }