protected void Awake()
        {
            item   = this.GetComponent <Item>();
            module = item.data.GetModule <ItemModuleKyberCrystal>();

            bladeMaterial = item.definition.GetCustomReference("BladeMaterial").GetComponent <MeshRenderer>().material;
            idleSound     = item.definition.GetCustomReference("IdleSound").GetComponent <AudioSource>();
            glowMaterial  = item.definition.GetCustomReference("GlowMaterial").GetComponent <MeshRenderer>().material;
            glowLight     = item.definition.GetCustomReference("GlowLight").GetComponent <Light>();
            startSounds   = item.definition.GetCustomReference("StartSounds");
            stopSounds    = item.definition.GetCustomReference("StopSounds");
        }
Example #2
0
        protected void Awake()
        {
            item   = this.GetComponent <Item>();
            module = item.data.GetModule <ItemModuleKyberCrystal>();

            bladeColour = new Color(module.bladeColour[0], module.bladeColour[1], module.bladeColour[2], module.bladeColour[3]);
            coreColour  = new Color(module.coreColour[0], module.coreColour[1], module.coreColour[2], module.coreColour[3]);
            glowColour  = new Color(module.glowColour[0], module.glowColour[1], module.glowColour[2], module.glowColour[3]);

            mesh      = item.GetCustomReference("Mesh").GetComponent <MeshRenderer>();
            propBlock = new MaterialPropertyBlock();
            mesh.GetPropertyBlock(propBlock);
            propBlock.SetColor("_BaseColor", coreColour);
            mesh.SetPropertyBlock(propBlock);

            itemTrans = item.transform;

            for (int i = 0, l = item.collisionHandlers.Count; i < l; i++)
            {
                item.collisionHandlers[i].OnCollisionStartEvent += CollisionHandler;
            }
        }