コード例 #1
0
    public static EffectMuzzleFlash CreateObject(GameObject g)
    {
        EffectMuzzleFlash d = GetGameObject <EffectMuzzleFlash>(false, "MuzzleFlash", ResourceInformation.Effect.transform);

        //Vector3 v = new Vector3(g.transform.position.x,
        //    g.transform.position.y,
        //    g.transform.position.z);

        d.Parent.transform.rotation = g.transform.rotation;

        d.Parent.transform.position = g.transform.position;

        return(d);
    }
コード例 #2
0
    public void OnCallGunFire(int idir)
    {
        //銃弾エフェクト

        //現在位置の取得
        Vector3 CurrentPoint = new Vector3(Character.CurrentPoint.X * Character.PositionUnit,
                                           PosY,
                                           Character.CurrentPoint.Y * Character.PositionUnit);

        foreach (GunFireActionNumber val in GunFireActionNumbers)
        {
            if (val == GunFireActionNumber.BothGun || val == GunFireActionNumber.LeftGun || val == GunFireActionNumber.RightGun)
            {
                continue;
            }
            if (((int)val & idir) != 0)
            {
                CharacterDirection dir = CharacterDirection.Top;
                //方向の取得
                switch (val)
                {
                case GunFireActionNumber.Top:
                    dir = Character.Direction;
                    break;

                case GunFireActionNumber.TopLeft:
                    dir = CommonFunction.RelativeFrontLeft[Character.Direction];
                    break;

                case GunFireActionNumber.TopRight:
                    dir = CommonFunction.RelativeFrontRight[Character.Direction];
                    break;

                case GunFireActionNumber.Left:
                    dir = CommonFunction.RelativeLeft[Character.Direction];
                    break;

                case GunFireActionNumber.Right:
                    dir = CommonFunction.RelativeRight[Character.Direction];
                    break;

                case GunFireActionNumber.BottomLeft:
                    dir = CommonFunction.ReverseLeftDirectionVector[Character.Direction];
                    break;

                case GunFireActionNumber.BottomRight:
                    dir = CommonFunction.ReverseRightDirectionVector[Character.Direction];
                    break;

                case GunFireActionNumber.Bottom:
                    dir = CommonFunction.ReverseDirection[Character.Direction];
                    break;
                }
                //MapPoint mp = Character.DeathBlowTargetPoint[dir].Add(CommonFunction.CharacterDirectionVector[CommonFunction.ReverseDirection[dir]]);
                MapPoint mp = Character.DeathBlowTargetPoint[dir];
                //目標位置の取得
                Vector3 TargetPoint = new Vector3(mp.X * Character.PositionUnit + ((float)CommonFunction.CharacterDirectionVector[CommonFunction.ReverseDirection[dir]].X * 0.5f),
                                                  PosY,
                                                  mp.Y * Character.PositionUnit + ((float)CommonFunction.CharacterDirectionVector[CommonFunction.ReverseDirection[dir]].Y * 0.5f));

                //銃弾エフェクト
                EffectGunBulletSingle.CreateObject(CurrentPoint, TargetPoint, Character.DeathBlowTargetCharacter[dir], dir).Play();
            }
        }

        //マズルエフェクト
        if (((int)GunFireActionNumber.LeftGun & idir) != 0)
        {
            EffectMuzzleFlash.CreateObject(GunLeftPos).Play();
        }
        else if (((int)GunFireActionNumber.RightGun & idir) != 0)
        {
            EffectMuzzleFlash.CreateObject(GunRightPos).Play();
        }
        else if (((int)GunFireActionNumber.BothGun & idir) != 0)
        {
            EffectMuzzleFlash.CreateObject(GunRightPos).Play();
            EffectMuzzleFlash.CreateObject(GunLeftPos).Play();
        }

        //音
        SoundInformation.Sound.Play(SoundInformation.SoundType.Gun);
    }