示例#1
0
        public void CacheDefinitions()
        {
            Definitions = new Dictionary <uint, furniture>();
            DateTime Start = DateTime.Now;

            DataTable Data    = Engine.dbManager.ReadTable("SELECT * FROM furniture");
            var       RowEnum = Data.Rows.GetEnumerator();

            while (RowEnum.MoveNext())
            {
                DataRow Row = (DataRow)RowEnum.Current;

                furniture furni = new furniture()
                {
                    id        = (uint)Row["id"],
                    sprite_id = (int)Row["sprite_id"],
                    type      = Row["type"].ToString()
                };

                Definitions.Add(furni.id, furni);
            }

            DateTime End     = DateTime.Now;
            TimeSpan Expired = (End - Start);

            Engine.Logging.WriteTagLine("Cache", "Loaded {0} Item Definitions in {1} s and {2} ms", Definitions.Count, Expired.Seconds, Expired.Milliseconds);
        }
示例#2
0
    void Shoot()
    {
        //animator.SetBool("gunFired", true);
        muzzleFlash.Play();

        RaycastHit hitData;

        if (Physics.Raycast(playerCamera.transform.position, playerCamera.transform.forward, out hitData, range))
        {
            //Detect if the target hit was a raptor, if so then reduce its health
            raptor currentTarget = hitData.transform.GetComponent <raptor>();
            if (currentTarget != null)
            {
                currentTarget.takeDamage(damage);
            }

            furniture currentFurniture = hitData.transform.GetComponent <furniture>();
            if (currentFurniture != null)
            {
                currentFurniture.takeDamage(damage);
            }
        }

        //check if the object hit has a rigidbody, and if so, apply a force
        //TODO: make hit detection only work for objects with the "shootable" tag, and only allow furniture not raptors, have a force applied to them
        if (hitData.rigidbody != null)
        {
            hitData.rigidbody.AddForce(-hitData.normal * impactForce);
        }

        GameObject impactGO = Instantiate(impactEffect, hitData.point, Quaternion.LookRotation(hitData.normal));

        Destroy(impactGO, 0.25f);

        if (currentClip > 0)
        {
            currentClip -= 1;
        }

        if (currentClip == 0)
        {
            clipEmpty = true;
        }
    }
示例#3
0
        // -------------------- Constructor --------------------
        public TileFloor(Point location, int occupied, bool fire = false, bool smoke = false, FireExtinguisher presentFireExtinguisher = null)
        {
            this.location = location;
            this.onFire   = fire;
            this.HasSmoke = smoke;

            if (occupied == 0)
            {
                hasFurniture = furniture.None;
            }
            else if (occupied == 1)
            {
                hasFurniture = furniture.Chair;
            }
            else
            {
                hasFurniture = furniture.Table;
            }

            this.presentFireExtinguisher = presentFireExtinguisher;
        }