// 
		static public void Remove(Highlighter instance)
		{
			if (highlighters.Remove(instance) && instance.highlighted)
			{
				isDirty = true;
			}
		}
Exemple #2
0
    private void Start()
    {
        highlighter  = bodyMeshObj.AddComponent <HighlightingSystem.Highlighter>();
        m_Anim       = GetComponent <Animation>();
        m_Controller = GetComponent <CharacterController>();

        monster = FindObjectOfType <Monster>();
    }
		void Awake()
		{
			highlighter = GetComponent<Highlighter>();

            if(IconPos != null)
            {
                Icon = HUDIcon.Create(HUDIconType.Exploration);
                Icon.CallbackClick = OnIconClick;
                Icon.gameObject.SetActive(false);
            }
		}
Exemple #4
0
 //模型到达正确位置
 public void ToRightPos()
 {
     //transform.localPosition = m_FinalPos;//需更改风管之前安装的工序中手拿物体所到的位置的实现方法
     transform.position = obj_RightModel.transform.position;
     HighlightingSystem.Highlighter hler = obj_RightModel.GetComponent <HighlightingSystem.Highlighter>();
     //obj_RightModel.GetComponent<BoxCollider>().enabled = false;
     //obj_RightModel.tag = "Untagged";
     if (hler)
     {
         hler.FlashingOff();
     }
     obj_RightModel.SetActive(false);
 }
    public GameObject[] obj_ShowObj; //需要显示的物体

    public override void End()
    {
        for (int j = 0; j < obj_ShowObj.Length; ++j)
        {
            HighlightingSystem.Highlighter a = obj_ShowObj[j].GetComponent<HighlightingSystem.Highlighter>();
            if (a)
            {
                a.FlashingOff();
                a.enabled = false;
            }
        }
        base.End();
    }
Exemple #6
0
    private void Start()
    {
        if (highlighter == null)
        {
            highlighter = GetComponent <HighlightingSystem.Highlighter>();
        }
        if (highlighter == null)
        {
            highlighter = gameObject.AddComponent <HighlightingSystem.Highlighter>();
        }

        collider_           = GetComponent <Collider>();
        collider_.isTrigger = true;
    }
Exemple #7
0
    public void InitModel()
    {
        Model m = m_model.GetComponent <Model>();

        m.obj_StopListener = obj_BuildManager.obj_curBuildProcess.gameObject;
        m.obj_RightModel   = obj_BuildManager.GetCurRightModel();
        HighlightingSystem.Highlighter hler = m.obj_RightModel.GetComponent <HighlightingSystem.Highlighter>();
        if (hler)
        {
            hler.FlashingOn(Color.green, Color.green);
        }
        m.Init();
        m_model.transform.parent        = obj_Parent;
        m_model.transform.localPosition = Vector3.zero;
        obj_Player.m_MoveObject         = m_model.transform;
        obj_Player.Init();
    }
 public override void Init()
 {
     for (int i = 0; i < obj_HideObj.Length; i++)
     {
         obj_HideObj[i].SetActive(false);
     }
     for (int j = 0; j < obj_ShowObj.Length; ++j)
     {
         obj_ShowObj[j].SetActive(true);
         HighlightingSystem.Highlighter a = obj_ShowObj[j].GetComponent<HighlightingSystem.Highlighter>();
         if (a)
         {
             a.enabled = true;
             a.FlashingOn(Color.yellow, Color.yellow);
         }
     }
     Invoke("End", 1);
 }
		// 
		static public void Add(Highlighter highlighter)
		{
			highlighters.Add(highlighter);
		}
Exemple #10
0
		// Remove reference when Highlighter component is disabled
		static public void RemoveHighlighter(Highlighter h)
		{
			if (highlighters == null) { return; }

			int index = highlighters.IndexOf(h);
			if (index != -1)
			{
				highlighters.RemoveAt(index);
			}
		}
Exemple #11
0
		// Add reference when Highlighter component is enabled
		static public void AddHighlighter(Highlighter h)
		{
			if (highlighters == null) { highlighters = new List<Highlighter>(); }

			highlighters.Add(h);
		}
Exemple #12
0
 private void Start()
 {
     highlighter = gameObject.AddComponent <HighlightingSystem.Highlighter>();
 }
Exemple #13
0
        protected override void Start()
        {
            model = piece.gameObject.transform.FindChild("Model").gameObject;
            faceCameraContainer = piece.gameObject.transform.FindChild("FaceCameraContainer").gameObject;

            hpBarContainer = faceCameraContainer.transform.FindChild("HpBarContainer").gameObject;
            hpBar = hpBarContainer.transform.FindChild("hpbar").gameObject;
            hpBarfill = hpBarContainer.transform.FindChild("HpBarFill").gameObject;
            hpBarFillRenderer = hpBarfill.GetComponent<MeshRenderer>();
            hpBarSvgRenderer = hpBar.GetComponent<SVGRenderer>();
            hpBarSvgEnemy = loader.Load<SVGAsset>("UI/hpbar enemy");
            hpBarSvg = loader.Load<SVGAsset>("UI/hpbar");

            textContainer = hpBarContainer.transform.FindChild("TextContainer").gameObject;
            attackGO = textContainer.transform.FindChild("Attack").gameObject;
            healthGO = textContainer.transform.FindChild("Health").gameObject;
            armorGO = textContainer.transform.FindChild("Armor").gameObject;
            attackText = attackGO.GetComponent<TextMeshPro>();
            healthText = healthGO.GetComponent<TextMeshPro>();
            armorText = armorGO.GetComponent<TextMeshPro>();
            shield = faceCameraContainer.transform.FindChild("Shield").gameObject;
            cloak = faceCameraContainer.transform.FindChild("Cloak").gameObject;
            paralyze = faceCameraContainer.transform.FindChild("Paralyze").gameObject;
            root = faceCameraContainer.transform.FindChild("Root").gameObject;
            armorBG = faceCameraContainer.transform.FindChild("Armor").gameObject;

            eventIconContainer = faceCameraContainer.transform.FindChild("EventIconContainer").gameObject;
            circleBg = eventIconContainer.transform.FindChild("CircleBg").gameObject;
            eventIcon = eventIconContainer.transform.FindChild("Event").gameObject;
            deathIcon = eventIconContainer.transform.FindChild("Death").gameObject;
            rangeIcon = eventIconContainer.transform.FindChild("Range").gameObject;

            meshRenderer = model.GetComponentInChildren<MeshRenderer>();
            highlight = model.GetComponentInChildren<Highlighter>();

            attackText.text = piece.attack.ToString();
            healthText.text = piece.health.ToString();

            circleBg.SetActive(false);
            deathIcon.SetActive(false);
            eventIcon.SetActive(false);
            rangeIcon.SetActive(false);

            //rotate to model direction
            model.gameObject.transform.rotation = Quaternion.Euler(DirectionAngle.angle[piece.direction]);

            //find top of the mesh and adjust the hpbar to be just above it
            Vector3[] verts = model.GetComponentInChildren<MeshFilter>().sharedMesh.vertices;
            Vector3 topVertex = new Vector3(0, float.NegativeInfinity, 0);
            for (int i = 0; i < verts.Length; i++)
            {
                //Vector3 vert = transform.TransformPoint(verts[i]);
                Vector3 vert = verts[i];
                if (vert.y > topVertex.y)
                {
                    topVertex = vert;
                }
            }
            hpBarContainer.transform.localPosition = hpBarContainer.transform.localPosition.SetY(
                topVertex.y * 1.5f + 0.9f
            );

            UpdateHpBar();
        }
        // Remove reference when Highlighter component is disabled
        public static void RemoveHighlighter(Highlighter h)
        {
            if (highlighters == null)
                return;

            var index = highlighters.IndexOf(h);
            if (index != -1)
                highlighters.RemoveAt(index);
        }
 public void Highlight(bool on)
 {
     if (on) {
         var color = StakeColors[use];
         var model = part.FindModelTransform("model");
         if (highlighter == null) {
             var go = model.gameObject;
             highlighter = go.GetComponent<Highlighter>();
             if (highlighter == null) {
                 highlighter = go.AddComponent<Highlighter>();
             }
         }
         if (bound) {
             var color2 = XKCDColors.LightGreyBlue;
             highlighter.FlashingOn (color, color2, 1.0f);
         } else {
             highlighter.ConstantOn (color);
         }
         part.SetHighlightColor (color);
         part.SetHighlight (true, false);
     } else {
         if (highlighter != null) {
             part.SetHighlightDefault ();
             highlighter.Off ();
         }
     }
 }