コード例 #1
0
        void IMovable.Move()
        {
            switch (this.Status)
            {
            case BulletStatus.Flying:
                this.Top -= 4;

                IHittable obj = HitOthers();
                if (obj != null && obj is Brick)
                {
                    Brick b = (Brick)obj;
                    b.Status    = BrickStatus.Dead;
                    this.Status = BulletStatus.Dead;
                }
                if (obj != null && obj is Ball)
                {
                    this.Status = BulletStatus.Dead;
                    //    Ball b = new Ball();
                    //    Ball ob = (Ball)obj;
                    //    b.Left = ob.Left;
                    //    b.Top = ob.Top;
                    //    b.dx = -b.dx;
                    //    this.Parent.Controls.Add(b);
                }
                break;

            case BulletStatus.Dead:
                this.Visible = false;
                break;
            }
        }
コード例 #2
0
    void ReleaseKinomi(Collider col)
    {
        GameObject enemy;

        enemy = col.GetComponent <BulletData>().proj_player;
        //       enemy = col.gameObject;

        BulletStatus ebs      = enemy.GetComponent <BulletStatus>();
        Bullet       e_bullet = ebs.type[enemy.GetComponent <Status>().bullet_type];
        int          num      = (int)(status.kinomi_num * (e_bullet.damage / 100));

        status.kinomi_num -= num;
        Vector3 pos = transform.position;

        pos.y += 0.2f;
        for (int i = 0; i < num; i++)
        {
            GameObject kinomi = Instantiate(Kinomi_prefab, pos, new Quaternion(0, 0, 0, 0)) as GameObject;
            Vector3    force  = new Vector3(0, 100, 0);
            force.x = e_bullet.dispersion * Random.Range(-1f, 1f);
            force.z = e_bullet.dispersion * Random.Range(-1f, 1f);
            Vector3 norm = force.normalized;
            kinomi.GetComponent <Rigidbody>().AddForce(norm * 700f);
        }
    }
コード例 #3
0
 public void DeactivateBullet()
 {
     this.enabled = false;
     this.gameObject.SetActive(false);
     this.myBulletStatus     = BulletStatus.Waiting;
     this.transform.position = Vector3.zero;
 }
コード例 #4
0
 // Use this for initialization
 void Start()
 {
     status               = this.GetComponent <BulletStatus>();
     rigidbody2d          = GetComponent <Rigidbody2D>();
     rigidbody2d.velocity = transform.up.normalized * status.speed;
     vfacingstart         = transform.up.normalized;
 }
コード例 #5
0
ファイル: Effect.cs プロジェクト: f4sn/PastWorks
 // Use this for initialization
 void Start()
 {
     status = GetComponent <Status>();
     bs     = GetComponent <BulletStatus>();
     star_material.EnableKeyword("_EMISSION");
     SS = GameObject.Find("SoundSystem").GetComponent <SoundSystem>();
     star_material.SetColor("_EmissionColor", Color.HSVToRGB(0, 0, 0));
 }
コード例 #6
0
 // Use this for initialization
 void Awake()
 {
     system = GameObject.Find("System");
     io     = system.GetComponent <Io>();
     rb     = GetComponent <Rigidbody>();
     status = GetComponent <Status>();
     bs     = GetComponent <BulletStatus>();
     speed  = base_speed;
     _time  = Time.deltaTime;
     id     = (int.Parse(gameObject.tag.Substring(6, 1))) - 1;
     tk     = system.GetComponent <TimeKeeper> ();
 }
コード例 #7
0
ファイル: PlayerUICtrl.cs プロジェクト: f4sn/PastWorks
 void Start()
 {
     status     = GetComponent <Status> ();
     id         = int.Parse(tag.Substring(6, 1)) - 1;
     bs         = GetComponent <BulletStatus> ();
     ui_rank[0] = Sprite.Create(Resources.Load <Texture2D>("UI/r1"), new Rect(0, 0, 79, 104), Vector2.zero);
     ui_rank[1] = Sprite.Create(Resources.Load <Texture2D>("UI/r2"), new Rect(0, 0, 79, 104), Vector2.zero);
     ui_rank[2] = Sprite.Create(Resources.Load <Texture2D>("UI/r3"), new Rect(0, 0, 79, 104), Vector2.zero);
     ui_rank[3] = Sprite.Create(Resources.Load <Texture2D>("UI/r4"), new Rect(0, 0, 79, 104), Vector2.zero);
     bc_rank[0] = Sprite.Create(Resources.Load <Texture2D>("UI/rank1"), new Rect(0, 0, 318, 319), Vector2.zero);
     bc_rank[1] = Sprite.Create(Resources.Load <Texture2D>("UI/rank2"), new Rect(0, 0, 318, 268), Vector2.zero);
     bc_rank[2] = Sprite.Create(Resources.Load <Texture2D>("UI/rank3"), new Rect(0, 0, 318, 243), Vector2.zero);
     bc_rank[3] = Sprite.Create(Resources.Load <Texture2D>("UI/r4"), new Rect(0, 0, 0, 0), Vector2.zero);
 }
コード例 #8
0
ファイル: Effect.cs プロジェクト: f4sn/PastWorks
    void ReleaseKinomi(Collider col)
    {
        SS.playSound("damaged");
        GameObject enemy;

        enemy = col.GetComponent <BulletData>().proj_player;
        //       enemy = col.gameObject;

        BulletStatus ebs      = enemy.GetComponent <BulletStatus>();
        Bullet       e_bullet = ebs.type[enemy.GetComponent <Status>().bullet_type];
        float        damage   = e_bullet.damage;
        float        dist     = (enemy.transform.position - transform.position).magnitude;

        //long range damage
        Debug.Log(dist);
        if (dist > 20)
        {
            damage *= 1.5f;
        }
        else if (dist > 60)
        {
            damage *= 2;
        }
        else if (dist > 100)
        {
            damage *= 2.5f;
        }
        int num = (int)(status.kinomi_num * (e_bullet.damage / 100));

        status.kinomi_num -= num;
        Vector3 pos = transform.position;

        pos.y += 3f;
        for (int i = 0; i < num; i++)
        {
            GameObject kinomi = Instantiate(Kinomi_prefab, pos, new Quaternion(0, 0, 0, 0)) as GameObject;
            Vector3    force  = new Vector3(0, 100, 0);
            force.x = e_bullet.dispersion * Random.Range(-1f, 1f);
            force.z = e_bullet.dispersion * Random.Range(-1f, 1f);
            Vector3 norm = force.normalized;
            kinomi.GetComponent <Rigidbody>().AddForce(norm * 700f);
        }
        for (int i = 0; i < num * (e_bullet.reflect_bonus / 100f); i++)
        {
            GameObject kinomi = Instantiate(Kinomi_prefab, pos, new Quaternion(0, 0, 0, 0)) as GameObject;
            kinomi.GetComponent <KinomiCtrl>().MagnetMove(enemy);
        }
    }
コード例 #9
0
 void Start()
 {
     status       = this.GetComponent <BulletStatus>();
     ThislayMaxim = status.length;
     if (status.ReflecNo >= 0)
     {
         status.ReflecNo -= 1;
     }
     else
     {
         Destroy(gameObject);
     }
     if (status.lifeTime >= 0)
     {
         Destroy(gameObject, status.lifeTime);
     }
     ThisLayLengNow = 0;
 }
コード例 #10
0
    // Use this for initialization
    void Start()
    {
        status  = GetComponent <Status>();
        bstatus = GetComponent <BulletStatus>();
        bullet_base.Add("Long", long_bullet_base);
        bullet_base.Add("Middle", middle_bullet_base);
        bullet_base.Add("Short", short_bullet_base);
        bullet_base_scale.Add("Long", bullet_base["Long"].transform.localScale);
        bullet_base_scale.Add("Middle", bullet_base["Middle"].transform.localScale);
        bullet_base_scale.Add("Short", bullet_base["Short"].transform.localScale);
        bs.Add("Long", bstatus.type["Long"]);
        bs.Add("Middle", bstatus.type["Middle"]);
        bs.Add("Short", bstatus.type["Short"]);

        bullet_base["Long"].transform.localScale   = Vector3.zero;
        bullet_base["Middle"].transform.localScale = Vector3.zero;
        bullet_base["Short"].transform.localScale  = Vector3.zero;

        io = GameObject.Find("System").GetComponent <Io> ();
        id = int.Parse(tag.Substring(6, 1)) - 1;
        tk = GameObject.Find("System").GetComponent <TimeKeeper> ();
    }
コード例 #11
0
    void Spawn(Vector3 pt, Vector3 dir, int sourcePlayer)
    {
        // offset bullet a little to avoid colliding with camera
        Vector3 offsetPos = pt + dir.normalized * fireOffset;

        // calculate bullet velocity
        Vector3 bullectVelocity = bulletSpeed * dir.normalized;

        // calculate prefab rotation
        Vector3    rotationAxis  = Vector3.Cross(Vector3.forward, dir);
        float      rotationAngle = Vector3.Angle(Vector3.forward, dir);
        Quaternion quat          = Quaternion.AngleAxis(rotationAngle, rotationAxis);

        // spawn the bullet and set its color
        int        counter    = playerManager.playerStatusDic[sourcePlayer].bulletCounter++;
        string     objID      = "[" + sourcePlayer + "] Bullet " + counter++;
        GameObject spawnedObj = ViveShare_Server.Instance.Spawn(bulletPrefab, objID, offsetPos, quat);

        spawnedObj.GetComponent <Renderer>().material.SetColor("_Color", ShooterPlayerColorTable.colorTable[sourcePlayer]);
        spawnedObj.GetComponent <Renderer>().material.SetColor("_EmissionColor", ShooterPlayerColorTable.colorTable[sourcePlayer]);

        // set bullet param for clients
        ViveShare_Event.setBulletParamEvent.InvokeRemote(objID, bullectVelocity, ShooterPlayerColorTable.colorTable[sourcePlayer]);

        // attach bullet controller to spawned bullet
        BulletStatus status = spawnedObj.AddComponent <BulletStatus>();

        status.SetSource(sourcePlayer);
        status.SetPlayerStatusManager(playerManager);
        status.SetWallCollider(wallCollider);

        // set bullet property
        Rigidbody physics = spawnedObj.GetComponent <Rigidbody>();

        physics.velocity = bullectVelocity;
        physics.AddForce(bullectVelocity, ForceMode.Force);
    }
コード例 #12
0
 // Use this for initialization
 void Start()
 {
     status = GetComponent <Status>();
     bs     = GetComponent <BulletStatus>();
     star_material.EnableKeyword("_EMISSION");
 }
コード例 #13
0
 public void ActivateBullet()
 {
     this.enabled = true;
     this.gameObject.SetActive(true);
     this.myBulletStatus = BulletStatus.Active;
 }
コード例 #14
0
 public RegisterBulletCommand(BulletStatus current)
 {
     Contract.Requires(current != null);
     CurrentStatus = current;
 }
コード例 #15
0
 // Use this for initialization
 void Start()
 {
     status = GetComponent <Status> ();
     id     = int.Parse(tag.Substring(6, 1)) - 1;
     bs     = GetComponent <BulletStatus> ();
 }