Exemplo n.º 1
0
        public override void Start()
        {
            if (Sensor == null)
            {
                throw new ArgumentNullException("PriestDoorTrigger needs a reference to a sensor object with a sensor physics component");
            }

            var sensor = Sensor.GetComponent <PhysicsComponent>();

            if (sensor == null || sensor.IsSensor == false)
            {
                throw new ArgumentNullException("PriestDoorTrigger needs a reference to a sensor object with a sensor physics component");
            }

            _movement = GetComponent <MoveAlongPath>();
            if (_movement == null)
            {
                throw new ArgumentNullException("PriestDoorTrigger needs a MoveAlongPath component");
            }

            // Hook up coolsion event
            sensor.OnCollisionEnter += (go) =>
            {
                var stats = go.GetComponent <CharacterStats>();
                if (stats != null && stats.Category == CharacterCategory.CC_PRIEST)
                {
                    if (IsOpen == false)
                    {
                        IsOpen = true;
                        _movement.FollowPath();
                    }
                }
            };
        }
Exemplo n.º 2
0
        public override void Start()
        {
            _movement = GetComponent <MoveAlongPath>();

            if (_movement == null)
            {
                throw new ArgumentNullException("LiftController game object needs a move along path component to work.");
            }

            if (MoveBack)
            {
                _movement.OnFinishedPath += finishedPath;
            }
        }