Exemple #1
0
        /// <summary>
        /// tfCenter 位置に出現する。
        /// </summary>
        static public _Action3 spawnCenterPoint(_CharacterClassDefinition defCh, ref SpawnState state, ref SpawnInfo spawnInfo)
        {
            var pos = spawnInfo.tfCenter.position;

            var dirxz = Random.insideUnitCircle;

            var rot = Quaternion.LookRotation(new Vector3(dirxz.x, 0.0f, dirxz.y), Vector3.up);

            return(defCh.instantiate(pos, rot));
        }
Exemple #2
0
        /// <summary>
        /// グループテリトリーサークル内のランダムな地上位置に出現する。
        /// </summary>
        static public _Action3 spawnOnGround(_CharacterClassDefinition defCh, ref SpawnState state, ref SpawnInfo spawnInfo)
        {
            var pos = spawnInfo.group.getRandomPointOnCircle();

            var ray = new Ray(new Vector3(pos.x, 1024.0f, pos.z), Vector3.down);

            var hit = new RaycastHit();

            if (Physics.Raycast(ray, out hit, float.PositiveInfinity, UserLayer.groundForEnemy))
            {
                pos = hit.point;
            }


            var dirxz = Random.insideUnitCircle;

            var rot = Quaternion.LookRotation(new Vector3(dirxz.x, 0.0f, dirxz.y), Vector3.up);


            return(defCh.instantiate(pos, rot));
        }