示例#1
0
    public void Initialise(OrbBehaviour _orb)
    {
        m_orb            = _orb;
        m_orbInteraction = m_orb.gameObject.GetComponent <InteractionObject>();

        m_orbInteraction.PickedUp += OnPickedUp;
        m_orbInteraction.Dropped  += OnDropped;
    }
示例#2
0
    // call para spawnar uma nova particula
    public void SpawnNewOrb()
    {
        Debug.Log("New orb spawning");
        // instancia uma orb numa area e posiçao aleatoria dentro dessa area
        OrbBehaviour new_orb_ = Instantiate(orb_to_spawn_, spawn_Areas_[Random.Range(0, spawn_Areas_.Length)].GetRandomPosInside(),
                                            Quaternion.identity).GetComponent <OrbBehaviour>();

        // regista o spawner na nova orb
        new_orb_.RegistSpawnManager(this);
    }
示例#3
0
    private void HandleCollision(GameObject otherObject)
    {
        OrbBehaviour orb = otherObject.GetComponent <OrbBehaviour>();

        if (orb != null)
        {
            GameHelper.GetManager <AudioEventManager>().MakeAudioEvent(transform.position, 5.0f, MyEvent2);
            if (orb.TakeEnergy(m_energy * m_energyAttackModifier))
            {
                Destroy(gameObject);
            }
        }
    }
示例#4
0
    void CheckDespawn()
    {
        m_timeSinceLastDespawnCheck = 0.0f;
        OrbBehaviour orb            = FindObjectOfType <OrbBehaviour>();
        float        despawnRangeSq = m_despawnRange * m_despawnRange;

        if ((transform.position - orb.transform.position).sqrMagnitude > despawnRangeSq)
        {
            PlayerMovement player = FindObjectOfType <PlayerMovement>();
            if ((transform.position - player.transform.position).sqrMagnitude > despawnRangeSq)
            {
                Destroy(gameObject);
            }
        }
    }
示例#5
0
    public void Initialise(OrbBehaviour _orb)
    {
        m_orb = _orb;

        // Remove all children we've set up for visualisation in the editor
        for (int i = m_content.transform.childCount - 1; i >= 0; --i)
        {
            Destroy(m_content.transform.GetChild(i).gameObject);
        }

        foreach (ShopOption shopOption in m_shopData.m_options)
        {
            ShopTurretOptionUIBehaviour turretOptionUI = Instantiate(m_turretOptionPrefab, m_content.transform);
            turretOptionUI.Initialise(shopOption, _orb);
        }
    }
示例#6
0
    // coroutina para instanciaçao das orbs
    private IEnumerator StartSpawningOrbs()
    {
        // instancia o numero de orbs determinado
        for (int i = 0; i < total_inicial_spawn_count_; i++)
        {
            // instancia uma orb numa area e posiçao aleatoria dentro dessa area
            OrbBehaviour new_orb_ = Instantiate(orb_to_spawn_, spawn_Areas_[Random.Range(0, spawn_Areas_.Length)].GetRandomPosInside(),
                                                Quaternion.identity).GetComponent <OrbBehaviour>();

            // regista o spawner na nova orb
            new_orb_.RegistSpawnManager(this);

            // aguarda o proximo frame
            yield return(null);
        }
    }
示例#7
0
    private void UpdateAvailability()
    {
        m_timeSinceAvailabilityUpdate = 0.0f;

        OrbBehaviour orb = GameObject.FindObjectOfType <OrbBehaviour>();

        Vector2 myPosition  = transform.position;
        Vector2 orbPosition = orb.transform.position;

        float distanceFromOrb = (myPosition - orbPosition).magnitude;

        if (distanceFromOrb > m_maxDistanceFromOrb || distanceFromOrb < m_minDistanceFromOrb)
        {
            IsAvailable = false;
        }
        else
        {
            IsAvailable = true;
        }
    }
    private OrbBehaviour orb_behaviour; // referencia para o comportamento da orb

    // regista o comportamento da orb no trigger
    public void RegistOrbTriggerCallBacks(OrbBehaviour behaviour) => orb_behaviour = behaviour;
示例#9
0
 // Start is called before the first frame update
 void Start()
 {
     m_orb          = FindObjectOfType <OrbBehaviour>();
     m_collider     = GetComponent <Collider2D>();
     m_statsManager = GameHelper.GetManager <StatsManager>();
 }
示例#10
0
 private void Awake()
 {
     m_orb = FindObjectOfType <OrbBehaviour>();
 }