void Awake()
 {
     if (instance == null)
     {
         instance = this;
     }
     else if (instance != this)
     {
         Destroy(gameObject);
     }
     sfx.Initialize();
     enemyController = GetComponent <EnemyController> ();
 }
Example #2
0
    public override void Initialize()
    {
        base.Initialize();

        Sensor     = new TargetingSensor(body, 20f, 30f);
        bulletPool = Object.FindObjectOfType <BulletPool>();
        eye        = movingParts.Find("Eye");
        cam        = transform.Find("Cam");

        navigator = GetComponent <NavigatorAgent>();
        resolution res = navigator.brain.brainParameters.cameraResolutions[0];

        // See changes in ML-Agents/Scripts/Agent.cs line 548 ff.
        camTexture = new Texture2D(res.width, res.height, TextureFormat.RGB24, false)
        {
            filterMode = FilterMode.Point
        };
        // See /DepthCam/Shader/DepthAndMotion.cginc
        GetCam().Initialize(ref camTexture);
        navigator.SetCustonTexture(ref camTexture);

        sfx = GetComponentInChildren <SFX>();
        sfx.Initialize(this);
    }