コード例 #1
0
ファイル: HMSoldier.cs プロジェクト: goddie/u3dGameFramework
    /// <summary>
    /// Raises the shoot on event.
    /// </summary>
    protected override void OnShootOnEvent()
    {
        GameObject bulletPrefab = ResourceManager.GetInstance.LoadPrefab (testDB [0].Prefab);
        GameObject parent = StageManager.SharedInstance.EffectLayer;
        GameObject bullet = StageManager.SharedInstance.AddToStage (parent, bulletPrefab);
        baseBullet = bullet.AddComponent<BaseBullet> ();
        baseBullet.BattleAgent = this.BattleAgent;
        //baseBullet.transform.position  = battleAgent.GameObject.transform.position;
        baseBullet.Speed = 1136.0f / 1000.0f;

        Vector3 pos = MapUtil.RelativeMovePosition (BattleAgent.BaseSprite.HitPoint, BattleAgent.GameObject.transform);
        baseBullet.transform.position = new Vector3 (pos.x, pos.y, BattleAgent.GameObject.transform.position.z);

        AttackMessage message = new AttackMessage (BattleAgent, BattleAgent.Targets, 1);

        baseBullet.AttachTarget (message);
    }
コード例 #2
0
    /// <summary>
    /// Raises the shoot on event.
    /// </summary>
    override protected void OnShootOnEvent()
    {
        GameObject bulletPrefab = ResourceManager.GetInstance.LoadPrefab(testDB [0].Prefab);
        GameObject parent       = StageManager.SharedInstance.EffectLayer;
        GameObject bullet       = StageManager.SharedInstance.AddToStage(parent, bulletPrefab);

        baseBullet             = bullet.AddComponent <BaseBullet> ();
        baseBullet.BattleAgent = this.BattleAgent;
        //baseBullet.transform.position  = battleAgent.GameObject.transform.position;
        baseBullet.Speed = 1136.0f / 1000.0f;

        Vector3 pos = MapUtil.RelativeMovePosition(BattleAgent.BaseSprite.HitPoint, BattleAgent.GameObject.transform);

        baseBullet.transform.position = new Vector3(pos.x, pos.y, BattleAgent.GameObject.transform.position.z);

        AttackMessage message = new AttackMessage(BattleAgent, BattleAgent.Targets, 1);

        baseBullet.AttachTarget(message);
    }