Exemple #1
0
 void Start()
 {
     if (hudControl == null)
     {
         hudControl = new HudControl();
         hudControl.Init(thisTransform);
         hudControl.CreateHudName(playerName);
         hudControl.CreateHudScore(this.score);
     }
     if (isLocalPlayer)
     {
         sight.enabled   = true;
         sight.range     = sightRange;
         sight.spotAngle = sightAngle;
         quan.SetActive(true);
         ripArea.SetActive(false);
         EventMgr.instance.TriggerEvent("beginProcessInput");
         EventMgr.instance.AddListener <Vector3>("joystickMove", OnMove);
         EventMgr.instance.AddListener("joystickStop", OnStop);
         EventMgr.instance.AddListener <bool>("catchPress", OnCatchPress);
         EventMgr.instance.AddListener <bool>("runPress", OnRunPress);
         EventMgr.instance.AddListener <GameObject>("OnSignPress", OnSignPress);
         EventMgr.instance.AddListener("boxPress", OnBoxPress);
     }
     else
     {
         sight.enabled = false;
         quan.SetActive(false);
         ripArea.SetActive(false);
     }
     leftRunEnergy = runEnergy;
     if (hasAuthority)
     {
         RipMgr.instance.AddTarget(gameObject, bodyRadius);
     }
     if (isClient)
     {
         sightController = gameObject.AddMissingComponent <SightController>();
     }
     // 有可能是中途进入游戏
     model.SetActive(!hideInfo.hide);
     if (!hideInfo.hide && sightController.InSight)
     {
         if (hudControl != null)
         {
             hudControl.Show();
         }
         else
         if (hudControl != null)
         {
             hudControl.Hide();
         }
     }
 }
Exemple #2
0
 private void Awake()
 {
     if (Instance == null)
     {
         Instance = this;
         // DontDestroyOnLoad(gameObject); //use if you want to keep state of hud saved across scenes
     }
     else
     {
         Destroy(gameObject);
     }
 }
Exemple #3
0
 void OnDestroy()
 {
     if (isLocalPlayer)
     {
         mySelf = null;
     }
     EventMgr.instance.RemoveListener(this);
     RipMgr.instance.RemoveTarget(gameObject);
     if (hudControl != null)
     {
         hudControl.Release();
     }
     hudControl = null;
 }
Exemple #4
0
 public object this[int subval]
 {
     get
     {
         HudControl control = ((HudList)this.a.a).get_Item(this.b).get_Item(this.c);
         if (subval == 0)
         {
             if (control.GetType() == typeof(HudStaticText))
             {
                 return(((HudStaticText)control).get_Text());
             }
             if (control.GetType() == typeof(HudCheckBox))
             {
                 return(((HudCheckBox)control).get_Checked());
             }
         }
         else if ((subval == 1) && (control.GetType() == typeof(HudPictureBox)))
         {
             return(((HudPictureBox)control).get_Image().get_PortalImageID());
         }
         return(null);
     }
     set
     {
         HudControl control = ((HudList)this.a.a).get_Item(this.b).get_Item(this.c);
         if (subval == 0)
         {
             if (control.GetType() == typeof(HudStaticText))
             {
                 ((HudStaticText)control).set_Text((string)value);
             }
             if (control.GetType() == typeof(HudCheckBox))
             {
                 ((HudCheckBox)control).set_Checked((bool)value);
             }
         }
         else if ((subval == 1) && (control.GetType() == typeof(HudPictureBox)))
         {
             int num = (int)value;
             if (num == 0)
             {
                 ((HudPictureBox)control).set_Image(null);
             }
             else
             {
                 ((HudPictureBox)control).set_Image((ACImage)num);
             }
         }
     }
 }
Exemple #5
0
 public static void SetCrosshair(int crs)
 {
     HudControl.SetCrosshair(crosshairs[crs]);
 }
    void Start()
    {
        gameControl = GameObject.FindGameObjectWithTag("GameController");
        gameControlScript = gameControl.GetComponent<HudControl>();

        camera = Camera.main.gameObject;

        controller = GetComponent<Controller2D> ();
        controller.useColliderFunctions = true;

        // defino a gravidade baseado no tamanho do pulo que quero e no tempo de queda
        gravity = -(2 * maxJumpHeight) / Mathf.Pow (timeToJumpApex, 2);
        maxJumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        minJumpVelocity = Mathf.Sqrt (2 * Mathf.Abs (gravity) * minJumpHeight);
    }
Exemple #7
0
 public GameControl(MainMenu mainMenu, HudControl hudControl)
 {
     _mainMenu   = mainMenu;
     _hudControl = hudControl;
 }
Exemple #8
0
 public IControl this[string id]
 {
     get
     {
         if (this.b.ContainsKey(id))
         {
             return(this.b[id]);
         }
         Control    item     = null;
         HudControl control2 = this.a.get_Item(id);
         if (control2.GetType() == typeof(HudButton))
         {
             item = new Button();
         }
         if (control2.GetType() == typeof(HudCheckBox))
         {
             item = new CheckBox();
         }
         if (control2.GetType() == typeof(HudTextBox))
         {
             item = new TextBox();
         }
         if (control2.GetType() == typeof(HudCombo))
         {
             item = new Combo();
         }
         if (control2.GetType() == typeof(HudHSlider))
         {
             item = new Slider();
         }
         if (control2.GetType() == typeof(HudList))
         {
             item = new List();
         }
         if (control2.GetType() == typeof(HudStaticText))
         {
             item = new StaticText();
         }
         if (control2.GetType() == typeof(HudTabView))
         {
             item = new Notebook();
         }
         if (control2.GetType() == typeof(HudProgressBar))
         {
             item = new ProgressBar();
         }
         if (control2.GetType() == typeof(HudImageButton))
         {
             item = new ImageButton();
         }
         if (item == null)
         {
             return(null);
         }
         item.a = control2;
         item.b = id;
         item.Initialize();
         this.d.Add(item);
         this.b[id] = item;
         return(item);
     }
 }