void Start() { if(healthBarPool==null) { healthBarPool = FastPoolManager.GetPool(healthBarPrefab,true); } if(canvas==null) { canvas = GameObject.Find ("Canvas"); } setupUnit(); if(this.flying==false) { UnitFacade u = (UnitFacade) this.GetUnitFacade(); GameObject exit = GameObject.Find("CreepExit"); u.MoveTo(exit.transform.position,false); } if(!GameManager.REF.demo) { GameObject child = NGUITools.AddChild(CreepSpawner.hudRoot, this.hudTextPrefab); mText = child.GetComponent<HUDText>(); // Make the UI follow the target child.AddComponent<UIFollowTarget>().target = this.transform; } }
public override void OnEnter() { // check that we have MyScript referenced GameObject go = Fsm.GetOwnerDefaultTarget(gameObject); if (go == null) { return; } if (hudText == null) { hudText = go.GetComponent<HUDText>(); } string stringVal = ""; if (!textVal.IsNone) { stringVal = textVal.Value; } if (!floatVal.IsNone) { stringVal = floatVal.Value.ToString("F0"); } if (!intVal.IsNone) { stringVal = intVal.Value.ToString(); } hudText.Add(stringVal, c.Value, stayDuration.Value); Finish(); }
public override void Draw() { DrawRectangle(0.025f, 0.878f, 0.12f, 0.093f, 122, 127, 140, 255);; DrawHealth(); ShowNames(); TeamText.Draw(); DrawTeam(); DrawGoal(); DrawRectangle(0.098f, 0.87824f, 0.007f, 0.025f, 68, 74, 96, 255); if (isRadarActive) { ShowRadar(); } ShowTalking(); if (lastLooked + 300 > GetGameTimer()) { HUDText.Draw(); } base.Draw(); }
public event OnPlayerHpChangeEvent OnPlayerHpChange; //血量改变时候调用 // Use this for initialization void Start() { player = GetComponent <PlayerId>(); if (GameController.Instance.type == FightType.Team && player.playerId == PhotonEngine.Instance.role.Id) { fightController = GameController.Instance.GetComponent <FightController>(); isSyncAnim = true; } PlayerEffect[] peArray = GetComponentsInChildren <PlayerEffect>(); foreach (PlayerEffect pe in peArray) { mDict.Add(pe.gameObject.name, pe); } foreach (PlayerEffect pe in effectArray) //面板指定的特效 { mDict.Add(pe.gameObject.name, pe); } anim = GetComponent <Animator>(); hpPoint = transform.Find("hpPoint").transform; textGo = UIManager.instance.GetHudText(hpPoint); //添加伤害显示 hudText = textGo.GetComponent <HUDText>(); hp_max = PlayerInfomation.instance.Hp; hp_now = hp_max; }
void Start() { if (TranscriptTeamController.Instance.isTeam && TranscriptTeamController.Instance.globalMasterID == PhotonEngine.Instance.role.ID) { isSyncBoss = true; } lastPosition = transform.position; lastEulerAngles = transform.eulerAngles; minDistanceOutOfAttack = 100; minDistanceInAttack = attackDistance; attackTimer = attackRate; //switchAttackTimer = attackTargetTime;//满足第一次计时切换目标 switchTraceTimer = traceTargetTime; playerGoList = PlayerController.Instance.playerGoList; TranscriptManager.Instance.AddEnermy(this.gameObject); bloodPointGo = transform.Find("BloodPoint").gameObject; originHp = hp; attack01EffectGo = transform.Find("attack01").gameObject; attack02EffectGo = transform.Find("attack02").gameObject; attack03Pos = transform.Find("attack03Pos").transform; //player = TranscriptManager.Instance.playerGo.transform; damagePointGo = transform.Find("DamagePoint").gameObject; hudTextGo = HpNumberManager.Instance.GetHudText(damagePointGo); hudText = hudTextGo.GetComponent <HUDText>(); }
public HUDText AddDamageText(string text, Vector3 worldPosition, int fontSize = 45, float flyDuration = 0.4f, float stayTime = 0.5f) { GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(damageTextPath, typeof(GameObject)) as GameObject); HUDText hudText = tempGameObject.GetComponent <HUDText>(); hudText.Init(text, fontSize, Color.white, flyTextDepth); worldPosition = camera.ViewportToWorldPoint(worldPosition); worldPosition.y += 0.2f; worldPosition.x += 0.2f; tempGameObject.transform.position = worldPosition; Vector3 toPosition = new Vector3(worldPosition.x, worldPosition.y + 0.15f, worldPosition.z); TweenAlpha tweenAlpha; // TweenScale tweenScale = TweenScale.Begin(tempGameObject, 0.1f, Vector3.one); // tweenScale.from = Vector3.zero; if (flyDuration > 0) { TweenPosition tween = TweenPosition.Begin(tempGameObject, flyDuration, toPosition, true); tween.delay = stayTime; tweenAlpha = TweenAlpha.Begin(tempGameObject, flyDuration / 2, 0); tweenAlpha.delay = stayTime + (flyDuration / 2); } else { tweenAlpha = TweenAlpha.Begin(tempGameObject, 0.2f, 0); tweenAlpha.delay = stayTime; } EventDelegate.Add(tweenAlpha.onFinished, delegate() { hudText.Destroy(); }, true); return(hudText); }
IEnumerator ProgressChat() { mDisplay = true; // Get the Combat text for the current chatter. HUDText ct = mParticipants[mCurrentChatter].hudText; if (ct != null) { ct.Add(chatMessages[mCurrentMessage], Color.white, 2f); cameraLookAt.target = mParticipants[mCurrentChatter].lookAt; } yield return(new WaitForSeconds(4f)); mCurrentChatter++; mCurrentMessage++; if (mCurrentChatter >= mParticipants.Count) { mCurrentChatter = 0; } // Rand out of message start again if (mCurrentMessage >= chatMessages.Length) { mCurrentMessage = 0; yield return(new WaitForSeconds(5f)); } mDisplay = false; }
// Text will be on top popup and screen public HUDText AddFlyText(string text, Vector3 localPosition, int fontSize = 40, Color?c = null, float flyDuration = 0.4f, float stayTime = 1f) { Color color = c.HasValue ? (Color)c : Color.white; GameObject tempGameObject = NGUITools.AddChild(root, Resources.Load(flyTextPath, typeof(GameObject)) as GameObject); HUDText hudText = tempGameObject.GetComponent <HUDText>(); hudText.Init(text, fontSize, color, flyTextDepth); tempGameObject.transform.localPosition = localPosition; Vector3 toPosition = new Vector3(localPosition.x, localPosition.y + 100f, localPosition.z); TweenAlpha tweenAlpha; if (flyDuration > 0) { TweenPosition tween = TweenPosition.Begin(tempGameObject, flyDuration, toPosition, false); tween.delay = stayTime; tweenAlpha = TweenAlpha.Begin(tempGameObject, flyDuration / 2, 0); tweenAlpha.delay = stayTime + (flyDuration / 2); } else { tweenAlpha = TweenAlpha.Begin(tempGameObject, 0.2f, 0); tweenAlpha.delay = stayTime; } EventDelegate.Add(tweenAlpha.onFinished, delegate() { hudText.Destroy(); }, true); return(hudText); }
void Start(){ hudtextGo = NGUITools.AddChild (HUDParent._instance.gameObject, hudtextpre) ;//预设物体 hudtext =hudtextGo.GetComponent<HUDText> (); UIFollowTarget followTarget = hudtextGo.GetComponent<UIFollowTarget> ();//临时变量 followTarget.target = hudtextFollow.transform; followTarget.gameCamera = Camera.main; }
public Slot(GameObject cSlot, HUDText cTxtSlot, Camera cFpsCam) { slot = cSlot; txtSlot = cTxtSlot; fpsCam = cFpsCam; slotEmpty = true; }
public void UpdateHud(bool visible) { if (!this._hasHud) { if (this.mHpBar) { this.mHpBar.gameObject.SetActive(false); } return; } this.CheckNeedHudUpdate(); if (!this.NeedUpdateHud) { if (this.mHpBar) { this.mHpBar.SkipUpdate(); } return; } if (!this.mHpBar) { this.mHpBar = Singleton <CharacterView> .Instance.CreateHudBar(this.self); if (this.mHpBar == null) { return; } this.mHpBar.On_Spawn(); this.mText = Singleton <CharacterView> .Instance.CreateHudText(this.self); } if (this.mHpBar != null) { this.mHpBar.OnUpdate(visible, false); } }
// Use this for initialization void Start() { _instance = this; killerId = this.GetComponent <PlayerTransMove>().roleid; originHp = hp; Vector3 hpBarPos = PlayerController.Instance.hpBarPos; GameObject uiRootGo = GameObject.FindGameObjectWithTag("UIRoot"); //通过NGUI 实例化血条 if (this.GetComponent <PlayerTransMove>().roleid == PhotonEngine.Instance.role.ID) { playerHpBarGo = NGUITools.AddChild(PlayerController.Instance.uiRoot.gameObject, Resources.Load("PlayerHpBg") as GameObject); //更改血条位置 playerHpBarGo.transform.position = hpBarPos; hpSlider = playerHpBarGo.GetComponentInChildren <UISlider>(); hpLabel = playerHpBarGo.GetComponentInChildren <UILabel>(); hpLabel.text = hp + "/" + originHp; //null reference } anim = GetComponent <Animator>(); peArray = this.GetComponentsInChildren <PlayerEffect>(); foreach (PlayerEffect pe in peArray) { peDict.Add(pe.gameObject.name, pe); } //另一种类型的特效资源 foreach (PlayerEffect effect in effectArray) { peDict.Add(effect.gameObject.name, effect); } damagePointGo = transform.Find("DamagePoint").gameObject; hudTextGo = HpNumberManager.Instance.GetHudText(damagePointGo); hudText = hudTextGo.GetComponent <HUDText>(); }
void Start() { if (TranscriptTeamController.Instance.isTeam && TranscriptTeamController.Instance.globalMasterID == PhotonEngine.Instance.role.ID) { isSyncEnermy = true; } if (!TranscriptTeamController.Instance.isTeam) //单人 { isSyncEnermy = true; } lastPosition = transform.position; lastEulerAngles = transform.eulerAngles; minDistanceOutOfAttack = attackDistance; minDistanceInAttack = attackDistance; attackTimer = attackRate; switchAttackTimer = attackTargetTime;//满足第一次计时切换目标 switchTraceTimer = traceTargetTime; characterController = this.GetComponent <CharacterController>(); playerGoList = PlayerController.Instance.playerGoList; if (transform.Find("DamagePoint")) { hudTextGo = HpNumberManager.Instance.GetHudText(transform.Find("DamagePoint").gameObject); hudText = hudTextGo.GetComponent <HUDText>(); } originHp = hp; bloodPoint = transform.Find("BloodPoint").gameObject; TranscriptManager.Instance.AddEnermy(this.gameObject); }
void Awake() { mTrans = transform; mHudText = GetComponent <HUDText>(); mxExtend = 0.1172f; myExtend = 0.1806f; }
private bool isSyncPlayerAnimation = false; //表示是否需要同步动画 void Start() { player = GetComponent<Player>(); if (GameController.Instance.battleType == BattleType.Team && player.roleID == PhotonEngine.Instance.role.ID) //当前角色属于当前客户端 { battleController = GameController.Instance.GetComponent<BattleController>(); isSyncPlayerAnimation = true; } hp = PlayerInfo._instance.HP; PlayerEffect[] peArray = this.GetComponentsInChildren<PlayerEffect>(); foreach(PlayerEffect pe in peArray) { effectDict.Add(pe.gameObject.name,pe); } foreach(PlayerEffect pe in effectArray) { effectDict.Add(pe.gameObject.name,pe); } anim = this.GetComponent<Animator>(); damageShowPoint = transform.Find("DamageShowPoint"); hudTextGameObject = HpBarManager._instance.GetHudText(damageShowPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText>(); }
public override void TakeDamage(int attack) { if (playerInformation.HP <= 0) { return; } if (state == WolfState.Death) { return; } float value = Random.Range(0f, 1f); if (value < miss) { isAttacked = false; AudioSource.PlayClipAtPoint(misss_Audio, transform.position); HUDText.Add("miss", Color.white, 0.5f); } else { isAttacked = true; hp -= attack; StartCoroutine(ChangeColor()); HUDText.Add(-attack, Color.red, 0.5f); AudioSource.PlayClipAtPoint(attack1_Audio, transform.position); } }
void TakeDamageResponse(string guid, int hp, int hurtNum) { GameObject enermyGo = null; enermyGoDict.TryGetValue(guid, out enermyGo); HUDText hudText = null; if (null != enermyGo) { if (enermyGo.GetComponent <Enermy>()) { Enermy enermy = enermyGo.GetComponent <Enermy>(); if (enermy == null) { Debug.LogError("the enermy is not exist!"); return; } enermy.isSyncEnermy = false; hudText = enermy.hudText; } else if (enermyGo.GetComponent <Boss>()) { Boss boss = enermyGo.GetComponent <Boss>(); if (boss == null) { Debug.LogError("the boss is not exist!"); return; } boss.isSyncBoss = false; hudText = boss.hudText; } } }
public void ShowHUDText(GameObject followTarget, string content) { if (m_UICanvas == null) { m_UICanvas = GameObject.FindObjectOfType <Canvas>().gameObject; } if (m_UICanvas == null) { return; } GameObject hudtextObj = null; if (!ABUtils.ABGameObjectPool.GetInstance().TryUse(HUDTextTag, out hudtextObj)) { return; } HUDText hudtext = hudtextObj.GetComponent <HUDText>(); if (hudtext == null) { return; } hudtext.transform.SetParent(m_UICanvas.transform); RenderTheBubble(hudtext, followTarget, content); }
public void createHUDText(Transform targetPosition, string text, Color color, float duration) { if (HUDRoot.go == null) { GameObject.Destroy(this.gameObject); return; } _isStart = true; _playTime = duration; this.transform.parent = HUDRoot.go.transform; this.transform.localPosition = Vector3.zero; this.transform.localRotation = Quaternion.identity; this.transform.localScale = Vector3.one; this.gameObject.layer = HUDRoot.go.layer; gameObject.GetComponent <UIFollowTarget> ().target = targetPosition; HUDText hudText = gameObject.GetComponent <HUDText> (); hudText.Add(text, color, duration); }
void Start() { hudTextGo = NGUITools.AddChild(HudTextParent._Instance.gameObject, hudPrefab); hudText = hudTextGo.GetComponent <HUDText>(); follow = hudTextGo.GetComponent <UIFollowTarget>(); follow.target = hudTextFollow.transform; follow.gameCamera = Camera.main; }
void addHUDText() { GameObject child = NGUITools.AddChild(transform.gameObject, hudtext_prefab); mText = child.GetComponentInChildren<HUDText>(); // Make the UI follow the target child.AddComponent<UIFollowTarget>().target = transform; }
// Use this for initialization void Start () { GameObject Temp = NGUITools.AddChild(hudroot, HUDText_prefab); Temp.name = "Player_Text"; playerdmgtext = Temp.GetComponentInChildren<HUDText>(); Temp.AddComponent<UIFollowTarget>().target = playerObj.transform; Temp.GetComponent<UIFollowTarget>().top_level = 1; }
public void Set(HUDTransform transform) { this._transform = transform; player_name = transform.GetHUDComponent <HUDText>("name"); title = transform.GetHUDComponent <HUDSprite>("title"); guild_name = transform.GetHUDComponent <HUDText>("guild_name"); guild_icon = transform.GetHUDComponent <HUDSprite>("guild_icon"); }
public void DestroyHP() { if (null != mText) { Destroy(mText.gameObject, 1.5f); mText = null; } }
void Start() { hudtextGo = NGUITools.AddChild(HUDTextParent._instance.gameObject, hudtextPrefab); hudtext = hudtextGo.GetComponent <HUDText>();//獲取到prefab上面的HUDText腳本 UIFollowTarget followTarget = hudtextGo.GetComponent <UIFollowTarget>(); followTarget.target = hudtextFollow.transform; followTarget.gameCamera = Camera.main; }
public void Dispose() { // wipe all visible traces of this constraint in preparation for nullification VectorLine.Destroy(ref vectrosityLine); // also destroy the HUD base labelBase = null; lineLabel = null; }
private void Awake() { dialogPanel = GameObject.Find("Dialogue Box"); choicePanel = GameObject.Find("Choices Boxs"); npcNameText = GameObject.Find("NPC Name").GetComponent <HUDText>(); dialogText = GameObject.Find("Dialog Text").GetComponent <HUDText>(); choice1Text = GameObject.Find("Choice 1 text").GetComponent <HUDText>(); choice2Text = GameObject.Find("Choice 2 text").GetComponent <HUDText>(); }
private void Start() { player = TranscriptController.Instance.playerAnimation.transform; bloodPoint = transform.Find("BloodPoint"); hpbarGo = HpBarManager.Instance.GetHpBar(this.gameObject.transform.Find("HpBarPoint")); hudTextGo = HpBarManager.Instance.GetHudText(this.gameObject.transform.Find("HudTextPoint")); hpBarSlider = hpbarGo.GetComponentInChildren <UISlider>(); hUDText = hudTextGo.GetComponent <HUDText>(); }
void addHUDText() { GameObject child = NGUITools.AddChild(transform.gameObject, hudtext_prefab); mText = child.GetComponentInChildren <HUDText>(); // Make the UI follow the target child.AddComponent <UIFollowTarget>().target = transform; }
void Start() { animator = GetComponent <Animator>(); audioSource = GetComponent <AudioSource>(); characterMovement = GetComponent <Character>(); hudText = GetComponent <HUDText>(); currentHealthPoints = maxHealthPoints; }
void Start() { TranscriptManager._instance.enemyList.Add(this.gameObject); InvokeRepeating("CalcDistance", 0, 0.1f); Transform hpBarPoint = transform.Find("HpBarPoint"); hpBarGameObject = HpBarManager._instance.GetHpBar(hpBarPoint.gameObject); hpBarSlider = hpBarGameObject.transform.Find("Bg").GetComponent<UISlider>(); hudTextGameObject = HpBarManager._instance.GetHudText(hpBarPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText>(); }
void Start() { hudtextGo = NGUITools.AddChild(HUDTextParent._instance.gameObject, hudtextPrefab); hudtext = hudtextGo.GetComponent <HUDText> ();//獲取到prefab上面的HUDText腳本 followTarget = hudtextGo.GetComponent <UIFollowTarget> (); followTarget.target = hudtextFollow.transform; followTarget.gameCamera = Camera.main; ps = GameObject.FindGameObjectWithTag(Tags.player).GetComponent <PlayerStatus>(); }
void Start() { if (isFinishInit) { return; } isFinishInit = true; hudText = GetComponent <HUDText> (); panel = GetComponent <UIPanel> (); }
// Use this for initialization void Start() { hudTextGo = NGUITools.AddChild(HUDTextParent.instance.gameObject, hudTextPrefab); hudText = hudTextGo.GetComponent <HUDText>(); followTarget = hudTextGo.GetComponent <UIFollowTarget>(); followTarget.target = hudTextFollow.transform; followTarget.gameCamera = Camera.main; followTarget.uiCamera = UICamera.currentCamera; }
void Start(){ // HUDGo = GameObject.Instantiate (HUDtextprefab, Vector3.zero, Quaternion.identity) as GameObject; HUDGo = NGUITools.AddChild (HUDParent._instance.gameObject, HUDtextprefab) ;//预设物体 hudtext = HUDGo.GetComponent<HUDText> (); followTarget = HUDGo.GetComponent<UIFollowTarget> (); followTarget.target = HUDFollow.transform; followTarget.gameCamera = Camera.main; // followTarget.uiCamera = UICamera.current.GetComponent<Camera> (); psxu = GameObject.FindGameObjectWithTag (Tags.player).GetComponent<PlayerStatus> (); }
/// <summary> /// 实现伤害数字向上漂浮消失的表现 /// </summary> public static void AddHudTextShow(GameObject go, HUDText hud, string showText, Color c, float delay = 0) { GameObjectActionExcute gae = GameObjectActionExcute.CreateExcute(go); GameObjectActionWait wait = new GameObjectActionWait(delay); wait.Data1 = hud; wait.Data2 = showText; wait.Data3 = c; wait.m_complete = ShowHudText; gae.AddAction(wait); }
private void UpdateText(HUDText item) { Vector2 v = Camera.main.WorldToViewportPoint(item.InitPos); Vector2 v2 = new Vector2((v.x) + item.Xcountervail, -(v.y - item.Ycountervail)); item.Rect.anchorMax = v; item.Rect.anchorMin = v; item.Rect.anchoredPosition = v2; item.m_Text.text = item.text; }
public void DestroyHUD(GameObject target, float time = 0) { HUDText t = null; if (hudDic.ContainsKey(target)) { t = hudDic[target]; StartCoroutine(DestroyH(t, time)); hudDic.Remove(target); } }
// Use this for initialization void Start() { // We need the HUD object to know where in the hierarchy to put the element if (HUDRoot.go == null) { GameObject.Destroy(this); return; } GameObject child = NGUITools.AddChild(HUDRoot.go, prefab); mText = child.GetComponentInChildren<HUDText>(); }
void Start(){ hpTotal = hp; bloodPoint = transform.Find("BloodPoint"); cc = this.GetComponent<CharacterController> (); InvokeRepeating ("CalcDistance",0,0.1f); hpBarPoint = transform.Find("HpBarPoint"); hpBarGameObject = HpBarManager._instance.GetHpBar (hpBarPoint.gameObject); hpBarSlider = hpBarGameObject.transform.Find ("Bg").GetComponent<UISlider>(); hudTextGameObject = HpBarManager._instance.GetHudText (hpBarPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText> (); }
// Use this for initialization void Start () { animationMoveCurrent = animationIdle; //hudtextGo = GameObject.Instantiate (hudtextPrefab,Vector3.zero,Quaternion.identity) as GameObject; //hudtextGo.transform.parent = HUDTextRoot._instance.gameObject.transform; hudtextGo = NGUITools.AddChild (HUDTextRoot._instance.gameObject, hudtextPrefab); hudtext = hudtextGo.GetComponent<HUDText> (); followTarget = hudtextGo.GetComponent<UIFollowTarget> (); followTarget.target = hudtextFollow.transform; followTarget.gameCamera = Camera.main; }
protected override void OnAwakeInitUI() { mTitleLabel = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/Title"); mDesLabel = CacheTrans.FindComponent <UILabel>("Root/ContainerCenter/DialogGroup/ButtonGroup/DesLabel"); mConfirmButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/ConfirmButton"); mCanelButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/CanelButton"); mOkButton = CacheTrans.FindComponent <UIButton>("Root/ContainerCenter/DialogGroup/ButtonGroup/OkButton"); mHUDText = CacheTrans.FindComponent <HUDText>("HUDText"); mRoot = CacheTrans.FindComponent <Transform>("Root"); mMaskCollider = CacheTrans.FindComponent <Transform>("MaskCollider"); }
void Start() { if (gameCamera == null) gameCamera = Camera.main; if (uiCamera == null) uiCamera = UICamera.currentCamera; if (normalHarm == null) { foreach (Transform t in transform) { if (t.name == "HUDNormal") { normalHarm = t.GetComponent<HUDText>(); break; } } } if (critHarm == null) { foreach (Transform t in transform) { if (t.name == "HUDCrit") { critHarm = t.GetComponent<HUDText>(); break; } } } }
void InitUI() { //GameObject g = Instantiate(hpSlider_obj, transform.position, Quaternion.identity)as GameObject; //g.transform.parent = GameObject.Find ("UI Root").transform; GameObject g = NGUITools.AddChild(GameObject.Find ("UI Root"), hpSlider_obj); hpSlider = g.GetComponent<UISlider>(); GameObject h = NGUITools.AddChild(GameObject.Find ("UI Root"), hud_obj); hd = h.GetComponent<HUDText>(); h.SendMessage("FollowTarget", transform); g.transform.localScale = hpBarScale; g.SendMessage("FollowTarget",transform); DisplayHpBar(); }
void Start(){ PlayerEffect[] peArray = this.GetComponentsInChildren<PlayerEffect>(); foreach(PlayerEffect pe in peArray) { effectDict.Add(pe.gameObject.name, pe); } foreach(PlayerEffect pe in effectArray) { effectDict.Add(pe.gameObject.name, pe); } damageShowPoint = transform.Find("DamageShowPoint"); hudTextGameObject = HpBarManager._instance.GetHudText(damageShowPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText>(); }
// Use this for initialization void Start() { // We need the HUD object to know where in the hierarchy to put the element if (HUDRoot.go == null) { GameObject.Destroy(this); return; } GameObject child = NGUITools.AddChild(HUDRoot.go, prefab); mText = child.GetComponentInChildren<HUDText>(); child.AddComponent<UIFollowTarget>().target = transform; // Add this character as part of conversation. if (ChatManager.instance != null) ChatManager.instance.AddParticipant(this); }
void Update() { if (!instantiated) { // create HUD text heirarchy if (HUDRoot.go != null) { labelBase = new GameObject("labelbase" + name); labelBase.transform.position = ball.transform.position; hudChild = NGUITools.AddChild(HUDRoot.go,globalVals.hudPrefab); lineLabel = hudChild.GetComponentInChildren<HUDText>(); hudChild.AddComponent<UIFollowTarget>().target = labelBase.transform; hudChild.GetComponent<UIFollowTarget>().uiCamera = guiManager.hudCam; hudChild.GetComponent<UIFollowTarget>().gameCamera = guiManager.cam1; instantiated = true; } } }
void Start() { targetGo = GameController.Instance.GetPlayerByRoleID(targetRoleId); TranscriptManager._instance.AddEnemy(this.gameObject); hpTotal = hp; bloodPoint = transform.Find("BloodPoint"); cc = this.GetComponent<CharacterController>(); InvokeRepeating("CalcDistance",0,0.1f); Transform hpBarPoint = transform.Find("HpBarPoint"); hpBarGameObject = HpBarManager._instance.GetHpBar(hpBarPoint.gameObject); hpBarSlider = hpBarGameObject.transform.Find("Bg").GetComponent<UISlider>(); hudTextGameObject = HpBarManager._instance.GetHudText(hpBarPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText>(); if (GameController.Instance.battleType == BattleType.Team && GameController.Instance.isMaster) { InvokeRepeating("CheckPositionAndRotation",0,1f/30f); InvokeRepeating("CheckAnimation",0,1f/30f); } }
void Start() { bloodPoint = transform.Find("BloodPoint").transform; hpPoint = transform.Find("HpPoint").transform; cc = this.GetComponent<CharacterController>(); InvokeRepeating("GetCurrentDistance", 0, 0.1f); attackTimer = attackRate; hp = TotalHp; hpBar = HpBarManager._instance.GetHpBar(hpPoint.gameObject); damageHudText = HpBarManager._instance.GetHudText(hpPoint.gameObject); hpSlider = hpBar.GetComponentInChildren<UISlider>(); hudText = damageHudText.GetComponent<HUDText>(); me = gameObject.GetComponentInChildren<MeshExploder>(); if (GameManger._instance.battleType == BattleType.Team && GameManger._instance.isMaster) { InvokeRepeating("AsyncEnemyPostionRotation", 0, 1f / 30); InvokeRepeating("CheckAnimation", 0, 1f / 30); } }
// Use this for initialization void Start () { m_queueDamageNum = new Queue<string>(); this.m_damagePrefab = AssetManager.Singleton.LoadAsset<GameObject>(FilePath.FONT_PATH + "red.prefab"); // this.m_damagePrefab = AssetManager.Singleton.LoadAsset<GameObject>(FilePath.PREFAB_PATH + "damageNum.prefab"); this.m_damageTarget = transform.FindChild("pivot"); if (null == m_damageTarget) { Debug.LogWarning("The Object used a damageNum Script but with no pivot!!!!!"); m_damageTarget = transform; } m_damange = NGUITools.AddChild(GameObject.FindWithTag("UI"), m_damagePrefab); UIFont font = m_damange.GetComponent<UIFont>(); this.m_damageNum = m_damange.AddMissingComponent<HUDText>(); m_damageNum.bitmapFont = font; UIFollowTarget myFollow = m_damange.AddMissingComponent<UIFollowTarget>(); myFollow.target = m_damageTarget; }
/*public void TargetMe(Transform _target) { target = _target; }*/ /* * 16 stunattack * 17 riseupattack2 * 18 shockattack * 19 darkattack * 20 nomalattack 鏅?氭敾鍑荷 * 21 powerattack * 22 skillattack 鎶鑳芥敾鍑荷 * 23 poisonattack * 24 deathattack * 25 generalattack * 26 pierceattack * 27 crowdattack * 28 pushattack 鏅?氭敾鍑荷 * 29 dropItem * 30 burnattack * 31 coldattack 鍐板睘鎬ф敾鍑荷 * */ void OnTriggerEnter(Collider other) { int attack_obj_layer = other.gameObject.layer; int atk; if (grabed || !life) return; else if (attack_obj_layer >=16) { //Debug.Log(block); //push = false; //accuracy = script_cha.GetCurCharData().m_hitrate; downhigh = script_cha.m_attackRising; HeroData hero = script_cha.GetCurCharData(); atk = MonoInstancePool.getInstance<HeroManager> ().calcAttack(hero); atk = Random.Range(2, 6); Vector3 pos = transform.position; pos.y += .16f; if (normalHUD == null || critHUD == null) { GameObject go = KMTools.AddGameObj(gameObject); go.transform.parent = transform; go.transform.position = pos; normalHUD = HUDRoot.AddNormalHarmNFollow(go.transform); critHUD = HUDRoot.AddCritHarmNFollow(go.transform); } if (normalHUD != null && critHUD != null) { if (atk > 5) critHUD.Add(atk.ToString(), pos); else normalHUD.Add(atk.ToString()); } if (attack_obj_layer == 28) { attackdir = mytransform.position - cha1.position; attackdir.y = 0; attackdir = Vector3.Normalize(attackdir); } else { attackdir = mytransform.position - other.transform.position; attackdir.y = 0; magnitude_behitdir = attackdir.magnitude; if (magnitude_behitdir == 0) { } else if (magnitude_behitdir<0.08f) attackdir = attackdir/magnitude_behitdir *1.6f; else attackdir = attackdir/magnitude_behitdir; } //bomb effect //script_cha.m_ui.addBombNum(); // // if( GameObject.FindWithTag("Player") ) // attack_obj_layer = 31; // else // attack_obj_layer = 30; //attack_obj_layer = 28; switch(attack_obj_layer) { case 20: // normal attack attackforce = 40; //Todo Lee // int blockrate = Random.Range (0,100); // if (blockrate<block-accuracy && monmovestat>=0) // { // script_cha.Blocked(mytransform.position); // rigidbody.AddForce ( attackdir *10); // //script_sound.SoundOn(0); // return; // } damage = atk; script_cam.Hitcam(); //downhigh = false; target = cha1; script_monEf.CreatBlood (mytransform.position,attackdir); break; case 21: // power attack attackforce = 30; damage = atk; script_cam.Hitcam2(1); downhigh = true; target = cha1; script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); break; case 22: // skill attack // attackforce = 10; // damage = other.rigidbody.mass ; // script_cam.Hitcam(); // downhigh = true; target = cha1; HitProcess(other.GetComponent<Rigidbody>().mass); script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); break; case 23: // poison attack attackforce = 10; float poisonMass = other.GetComponent<Rigidbody>().mass; if (poisonMass == 0.1f) { damage = 0; poison = true; poison_damage = atk*0.6f ; poison_delay = 4; downhigh = false; target = cha1; return; //Debug.Log("tt"); } else { poison = true; poison_damage = poisonMass ; damage = poison_damage*50; script_cam.Hitcam(); downhigh = true; poison_delay = 5; target = cha1; script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); } break; case 24: // death attack attackforce = 0; script_cam.Hitcam(); life = false; petrify_rate = (int)other.GetComponent<Rigidbody>().mass; gameObject.layer = 10; StartCoroutine(Petrify()); monrender.material.mainTexture = script_monEf.attribute_tex[1]; target = cha1; script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); break; case 25: // arrow attack attackforce = 60; damage = atk; target = cha1; script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); downhigh = false; break; case 26: // pierce attack myanimation.AddClip(script_monEf.pierce,"pierced"); myanimation["pierced"].speed = 0.3f; StartCoroutine(Pierced()); attackforce = 0; pierce = true; life = false; GetComponent<Collider>().enabled = false; damage = other.GetComponent<Rigidbody>().mass; hp -= (short)damage; target = cha1; script_hpbar.Damaged(maxhp,0,mytransform,9,0); script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); break; case 27: // crowd attack attackforce = 10; damage = other.GetComponent<Rigidbody>().mass; target = other.transform; script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); targetreset = true; downhigh = false; break; case 28: // push attack attackforce = 40; damage = atk; script_cam.Hitcam(); //downhigh = false; target = cha1; script_monEf.CreatBlood (mytransform.position,attackdir); break; case 29: //riseup attack attackforce = 0; damage = atk*0.4f; //script_cam.Hitcam(); downhigh = false; if(risedrop) f_risefactor = 0.6f; else { mytransform.rotation = Random.rotation; f_risefactor = 3.4f; } risedrop = true; target = cha1; script_monEf.CreatHitEffect_Only (mytransform.position,attackdir); break; case 30: // burn attack attackforce = 40; damage = atk; if (other.transform.root == cha1) script_cam.Hitcam(); target = cha1; if (att_status != 2) { monrender.material.mainTexture = script_monEf.attribute_tex[0]; //script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); script_monEf.CreatBlood (mytransform.position,attackdir); //CancelInvoke("BurnDamage"); InvokeRepeating("BurnDamage",0.5f,1.0f); StartCoroutine(Burn()); att_status = 1; } break; case 31: // cold attack attackforce = 40; downhigh = false; damage = atk; if (other.transform.root == cha1) script_cam.Hitcam(); target = cha1; if (att_status != 1) { if (!myanimation.IsPlaying("down_high")) { myanimation.enabled = false; //script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); monrender.material.mainTexture = script_monEf.attribute_tex[1]; script_monEf.CreatBlood (mytransform.position,attackdir); StartCoroutine(Freeze((short)(damage))); att_status = 2; } } break; case 16: // stun attack attackforce = -10; downhigh = false; damage = 0; //script_cam.Hitcam(); target = cha1; if (att_status != 1) { myanimation.enabled = false; //script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); //script_monEf.CreatBlood (mytransform.position,attackdir); StartCoroutine(Freeze((short)(damage))); att_status = 2; } break; case 17: //riseup attack2 attackforce = 0; damage = atk*0.2f; //damage = other.rigidbody.mass ; script_cam.Hitcam2(0.08f); downhigh = false; if(risedrop) f_risefactor = 0.6f; else { mytransform.rotation = Random.rotation; f_risefactor = 1.2f; } risedrop = true; target = cha1; script_monEf.CreatBlood (mytransform.position,attackdir); //script_monEf.CreatBlood_Only (mytransform.position,attackdir); break; case 18: // shock attack attackforce = 40; damage = atk; if (other.transform.root == cha1) script_cam.Hitcam(); target = cha1; if (att_status != 3) { monrender.material.mainTexture = script_monEf.attribute_tex[2]; //script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); script_monEf.CreatBlood (mytransform.position,attackdir); //CancelInvoke("BurnDamage"); InvokeRepeating("ShockDamage",0.5f,0.1f); StartCoroutine(Shock((short)(damage))); att_status = 3; } break; case 19: // darken attack attackforce = 40; damage = atk; if (other.transform.root == cha1) script_cam.Hitcam(); target = cha1; //if (clone_weapon!=null) //clone_weapon.gameObject.layer = 20; if (att_status != 4) { monrender.material.mainTexture = script_monEf.attribute_tex[3]; //script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,2); script_monEf.CreatBlood (mytransform.position,attackdir); //InvokeRepeating("BurnDamage",0.5f,1.0f); StartCoroutine(Darken()); att_status = 4; } break; } movespeed = 0; script_sound.SoundOn(1); if (!life) { if (pierce) { myanimation.Play("pierced"); pierce = false; } else myanimation.Stop(); } else { myanimation.Stop(); if (downhigh) { mytransform.Rotate ( 0, Random.Range(0,360),0); myanimation.Play("down_high"); } else { myanimation.Play("down"); } GetComponent<Rigidbody>().AddForce (attackdir * attackforce); if (directionVector == Vector3.zero) directionVector = -Vector3.forward; if (damage >0) { hp -= (short)damage; script_monEf.SetDamageNum(mytransform.position,(short)damage,attackdir); script_hpbar.Damaged(maxhp,hp,mytransform,hpbar_height,-1); } if(Random.Range (0,5) == 0) { myaudio.clip = script_monEf.ScreamSFX(); myaudio.Play(); } } ////////////////dead if (hp <=0 && life) { if (!risedrop) Dead(2); } else if(target_fix) target = target_onlyone; } }
public void Draw(constraint_drawtype drawtype) { Vector3 labelPosition = transform.position; // truncate render array // ****** WORK SPOT // ****** should also destroy previous version of this line here renderedPoints = new Vector3[0]; // handle line drawing based on chosen line type if (drawtype == constraint_drawtype.FullLine) { // need all points possible for the line renderedPoints = points; vectrosityLine = RenderPoints(); } else if (drawtype == constraint_drawtype.HalfLine) { // need only half the points int halfSizeIndex = System.Int32.Parse(Mathf.Round(points.Length/2).ToString()); renderedPoints = new Vector3[halfSizeIndex]; for (int n=0;n<halfSizeIndex;n++) renderedPoints[n] = points[n]; vectrosityLine = RenderPoints(); } else if (drawtype == constraint_drawtype.PrettyLine) { // draw a transparent wide line with an arrow } CalculateLineHeading(); // add label if (points.Length > 1) { if ((p_lineheading >= 315 && p_lineheading <= 360) || (p_lineheading > -1 && p_lineheading <=45)) { // augment x position labelPosition = new Vector3(transform.position.x-0.1f,transform.position.y+0.1f,transform.position.z); } else if (p_lineheading >= 225 && p_lineheading <= 315) { // decrement z position labelPosition = new Vector3(transform.position.x,transform.position.y+0.1f,transform.position.z-0.1f); } else if (p_lineheading >= 135 && p_lineheading <= 225) { // decrement x position labelPosition = new Vector3(transform.position.x+0.1f,transform.position.y+0.1f,transform.position.z); } else if (p_lineheading >= 45 && p_lineheading <= 135) { // increment z position labelPosition = new Vector3(transform.position.x,transform.position.y+0.1f,transform.position.z+0.1f); } } // generate label structure for NGUI HUDText if (HUDRoot.go != null) { labelBase = new GameObject("labelbase" + name); labelBase.transform.position = labelPosition; hudChild = NGUITools.AddChild(HUDRoot.go,globalVals.hudPrefab); lineLabel = hudChild.GetComponentInChildren<HUDText>(); hudChild.AddComponent<UIFollowTarget>().target = labelBase.transform; hudChild.GetComponent<UIFollowTarget>().uiCamera = guiManager.hudCam; hudChild.GetComponent<UIFollowTarget>().gameCamera = guiManager.cam1; } }
/// <summary> /// Allows the game to perform any initialization it needs to before starting to run. /// This is where it can query for any required services and load any non-graphic /// related content. Calling base.Initialize will enumerate through any components /// and initialize them as well. /// </summary> protected override void Initialize() { aspectRatio = (float)graphics.GraphicsDevice.Viewport.Width / (float)graphics.GraphicsDevice.Viewport.Height; Position = new Vector3(0, -46, 46); LookAt = new Vector3(0, 5, 0); Rotation = new Vector3(0, 0, 0); state = new XNAState(Keyboard.GetState(), Mouse.GetState()); Spielfeldbreite = 30; Spielfeldlaenge = 60; Punktestand_Spieler1 = 0; Punktestand_Spieler2 = 0; // hudtext hudtext = new HUDText(this, "SpriteFont1"); hudtext.Color = Color.White; Components.Add(hudtext); // Initialisierung der für die Beleuchtungsrechnung benötigten Vektoren Light_ambient = new Vector3(0f, 0f, 0f); Light_diffuse = new Vector3(1f, 1f, 1f); Light_specular = new Vector3(1f, 1f, 1f); Material_ambient = new Vector3(1f, 1f, 1f); Material_specular = new Vector3(1f, 1f, 1f); Lichtquelle = new Vector3(0, 0, 20); Camera = new Vector3(0, 0, 25); shininess = 1; base.Initialize(); }
void Start(){ hudtextGo = NGUITools.AddChild (HUDTextRoot._instance.gameObject, hudtextPrefab); hudtext = hudtextGo.GetComponent<HUDText> (); UIFollowTarget followTarget = hudtextGo.GetComponent<UIFollowTarget> (); followTarget.target = hudtextFollow.transform; followTarget.gameCamera = Camera.main; }
/// <summary> /// 显示被击数字 /// </summary> public override void OnDamaged( int num ,bool isSkillDamage,int type ) { Vector3 pos = transform.position; pos.y += .16f; //生成被击数字 if (normalHUD == null || critHUD == null) { GameObject go = KMTools.AddGameObj(gameObject); go.transform.parent = transform; go.transform.position = pos; normalHUD = HUDRoot.AddNormalHarmNFollow(go.transform); critHUD = HUDRoot.AddCritHarmNFollow(go.transform); } if (normalHUD != null && critHUD != null) { if( type == 1 ) critHUD.Add(num.ToString(), pos); else if( type == 3 ) normalHUD.Add(num.ToString()); } // 计算伤害 BurnDamage (num); }
void initHudText() { hudtextGo = HudTextParent._instacne.createHudText(); hudtext = hudtextGo.GetComponent<HUDText>(); followtarget = hudtext.GetComponent<UIFollowTarget>(); followtarget.target = hudtextFollow.transform; followtarget.gameCamera = Camera.main; StartCoroutine(setUIcamera()); }
// Use this for initialization void Start () { db = gameObject.AddComponent<MobDB> (); hudText = GetComponent<HUDText> (); }
// Use this for initialization void Start () { hudText = GetComponent<HUDText>(); FollowPlayer(); }
// Use this for initialization void Start () { //init the dictionary PlayerEffect[] peArray = this.GetComponentsInChildren<PlayerEffect>(); foreach (PlayerEffect pe in peArray) { effectDict.Add(pe.gameObject.name, pe); } foreach (PlayerEffect pe in effectArray) { effectDict.Add(pe.gameObject.name, pe); } anim = this.GetComponent<Animator> (); //hp bar position damageShowPoint = transform.Find ("DamageShowPoint"); //hp bar hudTextGameObject = HpBarManager._instance.GetHudText (damageShowPoint.gameObject); hudText = hudTextGameObject.GetComponent<HUDText> (); PlayerHpProgressBar._instance.Show (hp); }
// Use this for initialization void Start () { cc = this.GetComponent<CharacterController>(); agent = this.GetComponent<NavMeshAgent>(); normal = bodyrender.material.color; hudtextGo = HudTextParent._instacne.createHudText(); hudtext = hudtextGo.GetComponent<HUDText>(); followtarget = hudtext.GetComponent<UIFollowTarget>(); followtarget.target = hudtextFollow.transform; followtarget.gameCamera = Camera.main; cur_animName = animName_Idle; animate_attack_now = animName_Idle; initHpBar(); StartCoroutine(setUIcamera()); }