Esempio n. 1
0
    public void Initialize(ClientSideObject parent, ushort maxhp, ushort maxmp, byte level, float offset, byte faction)
    {
        this.parent       = parent;
        this.offset       = offset;
        hpSlider          = transform.FindChild("HP").GetComponent <Slider>();
        hpSlider.maxValue = maxhp;
        mpSlider          = transform.FindChild("MP").GetComponent <Slider>();
        mpSlider.maxValue = maxmp;

        if (faction == 0)
        {
            transform.FindChild("HP/Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.blue;
        }
        else if (faction == 1)
        {
            transform.FindChild("HP/Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.red;
        }
        else
        {
            transform.FindChild("HP/Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.yellow;
        }

        SetPositionAndValue();

        transform.FindChild("Text").gameObject.GetComponent <Text>().text = level.ToString();
    }
Esempio n. 2
0
    public bool WallStand(ClientSideObject target)
    {
        Vector3    origin = new Vector3(GetXPos(), 0.5f, GetZPos());
        Vector3    goal   = new Vector3(target.GetXPos(), 0.5f, target.GetZPos());
        Ray        ray    = new Ray(origin, goal - origin);
        RaycastHit hit;

        return(Physics.Raycast(ray, out hit, Vector3.Distance(goal, origin), wallLayerMask));
    }
Esempio n. 3
0
    public static void AddBullet(Bullet bullet)
    {
        ClientSideObject src  = GetObject(bullet.srcObjID);
        ClientSideObject dest = GetObject(bullet.destObjID);

        if (src != null && dest != null && src.IsVisible() && dest.IsVisible())
        {
            GameObject prefab = GameObject.Instantiate(Resources.Load("Prefabs/Bullet")) as GameObject;
            prefab.GetComponent <BulletScript>().Initialize(src.GetSrcBulletPos(), dest.GetDestBulletPos());
        }
    }
Esempio n. 4
0
    public void Initialize(ClientSideObject parent, ushort maxhp, float offset, byte faction)
    {
        this.parent     = parent;
        this.offset     = offset;
        slider          = GetComponent <Slider>();
        slider.maxValue = maxhp;

        if (faction == 0)
        {
            transform.FindChild("Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.blue;
        }
        else if (faction == 1)
        {
            transform.FindChild("Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.red;
        }
        else
        {
            transform.FindChild("Fill Area/Fill").gameObject.GetComponent <Image>().color = Color.yellow;
        }

        SetPositionAndValue();
    }
Esempio n. 5
0
 public void SetParent(ClientSideObject parent)
 {
     this.parent = parent;
 }
Esempio n. 6
0
 public float Distance(ClientSideObject target)
 {
     return(Vector2.Distance(new Vector2(target.GetXPos(), target.GetZPos()), new Vector2(this.GetXPos(), this.GetZPos()))
            - target.GetRadius() - this.GetRadius());
 }