Пример #1
0
        AudioSource audioSource;                // Audio Source

        public void init(ShipPatrolProperties m)
        {
            // cache the model as m
            this.m = m;

            // set model's speed based on data sourced from XML
            m.currentSpeed = m.targetSpeed = m.originalSpeed = (float)speed;

            // we use the model's speed variables going forward
            speed = null;

            // decide if ship's going right or left depending on its name
            if (gameObject.name.Contains("Right"))
            {
                m.isGoingRight = true;
            }

            // wakeAnimator
            foreach (Animator a in GetComponentsInChildren <Animator> ())
            {
                if (a.name[0] == 'W')
                {
                    wakeAnimator = a;
                }
            }

            // audio source cache
            audioSource = GetComponent <AudioSource> ();

            // slow down randomly to feel more human
            StartCoroutine(RandomSlowDown());

            // play audio delayed
            StartCoroutine(PlayAudioDelayed());
        }
Пример #2
0
        public ShipPatrolProperties registerShipPatrol(int instanceId)
        {
            ShipPatrolProperties p = new ShipPatrolProperties();

            shipPatrolPropertiesDict.Add(instanceId, p);

            return(p);
        }