Пример #1
0
	void Start () {
        movement = new Vector3(0,0,0);
        hittable = GetComponent<HittableBehaviour>();
        inventory = GetComponent<InventoryBehaviour>();
        rBody = GetComponent<Rigidbody2D>();
        spriteRenderer = GetComponent<SpriteRenderer>();
	}
Пример #2
0
 public void Drop(InventoryBehaviour inventory)
 {
     StartCoroutine(SendAction(inventory.info, ActionType.Remove));
     itemCollider.enabled = true;
     mesh.enabled         = true;
     rb.isKinematic       = false;
     gameObject.transform.SetParent(null);
     inventory.inventory.Remove(this);
 }
Пример #3
0
 private void Start()
 {
     if (item == null)
     {
         return;
     }
     icon.sprite        = item.icon;
     icon.enabled       = true;
     inventoryBehaviour = gameObject.transform.parent.GetComponent <InventoryText>().gameObject.transform.parent.gameObject.transform.parent.GetComponentInChildren <InventoryBehaviour>();
 }
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player"))
        {
            InventoryBehaviour playerInventory = other.gameObject.GetComponent <PlayerBehaviour>().GetInventory();

            playerInventory.AddToInventory(this);

            gameObject.SetActive(false);
        }
    }
Пример #5
0
 public void Respawn()
 {
     transform.parent = null;
     transform.position = originalPosition;
     transform.rotation = originalRotation;
     if (inventory) {
         if (inventory.item == this) {
             inventory.item = null;
         }
         inventory = null;
     }
 }
Пример #6
0
    private void Start()
    {
        Text[] texts = GetComponentsInChildren <Text>();
        m_InventoryBehaviour = m_MainPlayer.GetComponent <InventoryBehaviour>();
        m_SpaceshipBehaviour = m_MainPlayer.GetComponent <SpaceshipBehaviour>();

        foreach (Text text in texts)
        {
            switch (text.name)
            {
            case "Score":
                m_ScoreText = text;
                UpdateScore();
                break;

            case "Health":
                m_HealthText = text;
                UpdateHealth();
                break;
            }
        }

        RawImage[] rawImages = GetComponentsInChildren <RawImage>();
        foreach (RawImage image in rawImages)
        {
            switch (image.name)
            {
            case "BasicFire":
                m_BasicShoot = image;
                break;

            case "DoubleFire":
                m_DoubleShoot = image;
                break;

            case "Missile":
                m_MissileShoot = image;
                break;

            case "Invulnerability":
                m_Invulnerability = image;
                break;
            }
        }

        m_OriginalColor = m_BasicShoot.color;
        UpdatePrimarySlot();
        UpdateSecondarySlot();
        GameFlowManager.Instance.m_ScoreChangedEvent.AddListener(UpdateScore);
        m_SpaceshipBehaviour.m_HealthChangedEvent.AddListener(UpdateHealth);
        m_InventoryBehaviour.m_PrimarySlotChangedEvent.AddListener(UpdatePrimarySlot);
        m_InventoryBehaviour.m_SecondarySlotChangedEvent.AddListener(UpdateSecondarySlot);
    }
Пример #7
0
    void Start()
    {
        m_health    = GetComponent <HealthBehaviour>();
        m_inventory = GetComponent <InventoryBehaviour>();
        m_animator  = GetComponent <Animator>();
        m_rigidbody = GetComponent <Rigidbody>();

        m_health.OnDeath += Death;

        m_team = new Team();

        //Debug.Log(string.Format("{0}: Team {1}", gameObject.name, m_team.ID));
    }
Пример #8
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.transform != null)
        {
            InventoryBehaviour targetInventory = other.GetComponent <InventoryBehaviour>();

            if (targetInventory)
            {
                targetInventory.SwapActiveWeapon(m_weapon);
                gameObject.SetActive(false);
            }
        }
    }
Пример #9
0
    void OnTriggerEnter(Collider other)
    {
        inventory = other.gameObject.GetComponentInChildren<InventoryBehaviour>();

        if (inventory && inventory.item == null && !WasJustDetached) {
            transform.parent = inventory.transform;
            transform.position = inventory.AttachPoint.position;
            transform.rotation = inventory.AttachPoint.rotation;
            inventory.item = this;
            if (OnPickupReceiver != null) {
                OnPickupReceiver.OnMessage(OnPickupMessage);
            }
        }
    }
Пример #10
0
    void Start()
    {
        m_IsInsideCamera      = false;
        m_MovingTop           = true;
        m_IsRageMode          = false;
        m_SpaceshipBehaviour  = GetComponent <SpaceshipBehaviour>();
        m_InventoryBehaviour  = GetComponent <InventoryBehaviour>();
        m_SpriteRenderer      = GetComponent <SpriteRenderer>();
        m_ReceiveDamageEffect = GetComponent <ReceiveDamageEffect>();
        m_MaxHealth           = m_SpaceshipBehaviour.m_Health;
        m_SpaceshipBehaviour.m_CanRecieveDamage = false;

        AudioSource[] sources = GetComponents <AudioSource>();
        m_RageEnterSound = sources[sources.Length - 1];
    }
Пример #11
0
 public void PickUp(InventoryBehaviour inventory)
 {
     if (!dragging)
     {
         return;
     }
     StartCoroutine(SendAction(inventory.info, ActionType.Add));
     itemCollider.enabled = false;
     rb.isKinematic       = true;
     mesh.enabled         = false;
     gameObject.transform.SetParent(inventory.transform.parent.transform);
     inventory.AddToInventory.RemoveListener(PickUp);
     inventory.inventory.Add(this);
     inventory.drawGUI = false;
 }
Пример #12
0
    private void OnTriggerEnter(Collider other)
    {
        if (other.gameObject.CompareTag("Player") && !isOpen)
        {
            InventoryBehaviour playerInventory = other.gameObject.GetComponent <PlayerBehaviour>().GetInventory();

            // Check if all keys for this switch are in the inventory
            foreach (InventoryItemBehaviour key in keyList)
            {
                isOpen = playerInventory.InInventory(key);
                if (!isOpen)
                {
                    break;
                }
            }

            // Set the object inactive if it is open
            gameObject.SetActive(!isOpen);
        }
    }
Пример #13
0
    void Start()
    {
        m_IsDead              = false;
        m_Inventory           = GetComponent <InventoryBehaviour>();
        m_SpriteRenderer      = GetComponent <SpriteRenderer>();
        m_ReceiveDamageEffect = GetComponent <ReceiveDamageEffect>();
        if (m_CanShoot)
        {
            m_BulletBehaviour         = m_BasicBullet.GetComponent <BulletBehaviour>();
            m_OriginalBulletDirection = m_BulletBehaviour.m_Direction;
        }
        m_OriginalColor = m_SpriteRenderer.color;
        m_RigidBody2D   = GetComponent <Rigidbody2D>();
        m_CurrentTime   = 0.0f;

        //Assign sounds
        AudioSource[] audioSources = GetComponents <AudioSource>();
        m_AudioSource = audioSources[0];
        m_DieSound    = audioSources[0].clip;

        if (m_CanShoot)
        {
            m_BasicShootAudio = audioSources[1].clip;

            if (m_IsMainPlayer || m_IsFinalBoss)
            {
                m_DoubleShootAudio     = audioSources[2].clip;
                m_MissileAudio         = audioSources[3].clip;
                m_InvulnerabilityAudio = audioSources[4].clip;
                m_EmptyAudio           = audioSources[5].clip;
                if (m_IsMainPlayer)
                {
                    m_ReceiveDamageSound = audioSources[6].clip;
                }
            }
        }
    }
 private void Awake()
 {
     navigation         = GetComponent <TargetNavigationBehaviour>();
     inventoryInterface = GetComponent <InventoryBehaviour>();
 }
 public virtual void Start()
 {
     _inventoryBehaviour = GameObject.Find("Inventory").GetComponent <InventoryBehaviour>();
 }
Пример #16
0
 // Use this for initialization
 void Start()
 {
     inventory = GetComponent <InventoryBehaviour>();
 }
Пример #17
0
 private void Awake()
 {
     inventoryBehaviour = gameObject.AddComponent <InventoryBehaviour>();
 }
Пример #18
0
 private void Awake()
 {
     inventoryBehaviour =
         GameObject.FindGameObjectWithTag("Inventory").GetComponent <InventoryBehaviour>();
 }
Пример #19
0
 void Start()
 {
     characterController = GetComponent <CharacterController>();
     inventory           = GetComponent <InventoryBehaviour>();
 }
 private void Start()
 {
     m_InventoryText      = GameObject.Find("InventoryText").GetComponent <TMP_Text>();
     m_InventoryBehaviour = InventoryBehaviour.Instance;
 }