예제 #1
0
파일: Program.cs 프로젝트: barisel/C-Sharp
        static void Main(string[] args)
        {
            ActivatorManager.CreateInstance <UserManager>();
            ActivatorManager.CreateInstanceWithConst <UserManager>();
            var userList = ActivatorManager.CreateInstanceGenericList <UserManager>();
            var user     = ActivatorManager.GetInstance <UserManager>();
            var user2    = ActivatorManager.GetInstanceConst <UserManager>();

            // GetInstanceWithGenericConstructer
            Family family = new Family {
                FatherName = "zafer", MotherName = "ayse"
            };
            var user3 = ActivatorManager.GetInstanceWithGenericConstructer <UserManager, Family>(family);

            //
            var factory = new GenericFactory <string, UserManager>();

            factory.Register("key", typeof(Family));
            UserManager newInstance = factory.Create("key", family);
        }
예제 #2
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    //Esta función se ejecuta cuando se llama al Move del CharacterController
    void OnControllerColliderHit(ControllerColliderHit hit)
    {
        //Mejor lo hacemos con un Raycast, aquí no funciona correctamente
        /*
        //Moving platforms support
        if(hit.gameObject.name.Contains("Elevator") && hit.moveDirection.y < -0.9 && hit.normal.y > 0.5)
            activePlatform = hit.collider.transform;
        */

        //Comprobar choques por arriba
        if(hit.moveDirection.y > 0.9 && hit.normal.y < 0.5)
            if(moveDirection.y > 0.0f)
                moveDirection.y = 0.0f;

        //Switch to start the moving platform
        if(hit.gameObject.name.Contains("Activator"))
        {
            activatorManager = hit.gameObject.GetComponent<ActivatorManager>();
            activatorManager.SendMessage("Activate");
        }
    }
        protected override void Start()
        {
            mAM = ActivatorManager.Get();

            base.Start();
        }