void Start() { agent = GetComponent <NavMeshAgent>(); anim = GetComponent <Animator>(); health = GetComponent <HealthObject>(); Billboard stats = Instantiate(statsPrefab, transform.position, Quaternion.identity).GetComponent <Billboard>(); health.healthSlider = stats.GetComponent <Slider>(); health.speedText = stats.transform.Find("Speed").GetComponent <Text>(); health.defenseText = stats.transform.Find("Defense").GetComponent <Text>(); health.strengthText = stats.transform.Find("Strength").GetComponent <Text>(); stats.target = transform; stats.transform.SetParent(canvasParent, false); health.toDestroy.Add(stats.gameObject); health.strengthMultiplier = strengthMultipler; health.speedMultiplier = speedMultiplier; health.defenseMultiplier = defenseMultipler; health.strength = baseDamage * strengthMultipler; health.speed = baseSpeed * speedMultiplier; health.defense = baseProtection * defenseMultipler; agent.speed = health.speed; }
void UseSpellBillboardAnims(int record = 0, bool oneShot = false) { // Destroy any existing billboard game object if (myBillboard) { myBillboard.gameObject.SetActive(false); Destroy(myBillboard.gameObject); } // Add new billboard parented to this missile GameObject go = GameObjectHelper.CreateDaggerfallBillboardGameObject(GetMissileTextureArchive(), record, transform); go.transform.localPosition = Vector3.zero; go.layer = gameObject.layer; myBillboard = go.GetComponent <Billboard>(); myBillboard.FramesPerSecond = BillboardFramesPerSecond; myBillboard.FaceY = true; myBillboard.OneShot = oneShot; myBillboard.GetComponent <MeshRenderer>().receiveShadows = false; }