コード例 #1
0
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        lifeCycleSec = ParticleHelper.GetlifeCycleSec(transform);
        if (lifeCycleSec < 0)
        {
            isLoop = true;
        }
    }
コード例 #2
0
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        _animation = GetComponentInChildren <Animation> ();
        if (_animation != null)
        {
            _animation [animName].speed = speed;
            _palyTime = _animation [animName].length / speed;
            _animation.Play(animName);
        }
    }
コード例 #3
0
    // Use this for initialization
    virtual protected void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, BattleConfig.LAYER.BULLET);


//		float time = Mathf.Sqrt (HEIGHT * 2 / G);
        float time = HEIGHT / Mathf.Abs(speed);

        inertiaSpeed = INERTIA_OFFSET / time;

        transform.Translate(-INERTIA_OFFSET, 0, 0);
    }
コード例 #4
0
    // Use this for initialization
    void Start()
    {
        BattleFactory.AddUnitToLayer(gameObject, layer);

        _skeleton = GetComponentInChildren <SkeletonAnimation>();
        if (_skeleton != null)
        {
            _skeleton.state.TimeScale = speed;
            _animation = _skeleton.Skeleton.Data.FindAnimation(_skeleton.AnimationName);
            _palyTime  = _animation.Duration;
        }
    }
コード例 #5
0
ファイル: Bullet.cs プロジェクト: fchsg/UnityBattleTank
    protected void CreateEffect()
    {
        GameObject profab = !_shoot.isMiss ? explodeProfab: explodeMissProfab;

        if (profab == null)
        {
            profab = explodeProfab;
        }

        if (profab != null)
        {
//			GameObject effectObj = ResourceHelper.Load(AppConfig.FOLDER_PROFAB_ANIMATION + "testExplode/testExplode");
            GameObject effectObj = Instantiate(profab) as GameObject;
            BattleFactory.AddUnitToLayer(effectObj, BattleConfig.LAYER.EFFECT);
//			RenderHelper.ChangeWholeModelColor (effectObj, Color.green);
            effectObj.transform.position = transform.position;
        }
    }
コード例 #6
0
 // Use this for initialization
 void Start()
 {
     BattleFactory.AddUnitToLayer(gameObject, BattleConfig.LAYER.EFFECT);
 }
コード例 #7
0
    IEnumerator createBombs()
    {
        DataSkill dataSkill = _skill.GetDataSkill();
        float     range     = dataSkill.hintRange;

        List <Vector3> offsets = new List <Vector3> ();
        int            n       = COUNT;

        for (int i = 0; i < n; ++i)
        {
            float theta  = RandomHelper.Range01();
            float radius = Mathf.Sqrt(RandomHelper.Range01() * RandomHelper.Range01()) * range;

            float   x = radius * Mathf.Cos(2 * Mathf.PI * theta);
            float   z = radius * Mathf.Sin(2 * Mathf.PI * theta);
            Vector3 v = new Vector3(x, 0, z);

            offsets.Add(v);
        }

        /*
         * Vector3[] dropPositionOffsets = new Vector3[]{
         *
         *      new Vector3 (-range * 0.8f, 0, range * 0.2f),
         *      new Vector3 (-range * 0.8f, 0, -range * 0.2f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (-range * 0.4f, 0, range * 0.4f),
         *      new Vector3 (-range * 0.4f, 0, 0),
         *      new Vector3 (-range * 0.4f, 0, -range * 0.4f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (0, 0, +range * 0.6f),
         *      new Vector3 (0, 0, +range * 0.2f),
         *      new Vector3 (0, 0, -range * 0.2f),
         *      new Vector3 (0, 0, -range * 0.6f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (range * 0.4f, 0, range * 0.4f),
         *      new Vector3 (range * 0.4f, 0, 0),
         *      new Vector3 (range * 0.4f, 0, -range * 0.4f),
         *      new Vector3 (0, -1000, 0),
         *
         *      new Vector3 (range * 0.8f, 0, range * 0.2f),
         *      new Vector3 (range * 0.8f, 0, -range * 0.2f),
         *      new Vector3 (0, -1000, 0),
         *
         * };
         */

        for (int i = 0; i < offsets.Count; i++)
        {
            Vector3 offset = offsets[i];

            GameObject bomoObject = ResourceHelper.Load(AppConfig.FOLDER_PROFAB + "skill/BombAirStrike");
            BattleFactory.AddUnitToLayer(bomoObject, BattleConfig.LAYER.BULLET);

            SkillBombBase bomb = bomoObject.GetComponent <SkillBombBase>();
            bomb.Init(_skill, _targetPosition + offset);

            spawnBombs.Add(bomb);

            yield return(new WaitForSeconds(DROP_INTERVAL));

            /*
             * if(offset.y < 0)
             * {
             *      yield return new WaitForSeconds(DROP_INTERVAL_LONG);
             * }
             * else
             * {
             *      yield return new WaitForSeconds(DROP_INTERVAL_SHORT);
             * }
             */
        }

        _isStart = true;
    }