示例#1
0
 public AppearanceManager()
 {
     _weaponController      = new WeaponController();
     _wardrobeController    = new WardrobeController(_weaponController.RemountWeaponInPackage);
     _propController        = new PropController();
     _replaceMaterialShader = new ReplaceMaterialShader();
 }
示例#2
0
 private IEnumerator pairTracker(int seconds, PropController controller)
 {
     controller.hydraTracker.detach();
     controller.gameObject.SetActive(true);
     controller.activeChildren(false);
     controller.hydraTracker.PositionReference = controller;
     if (masterController.currentStage == MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING)
     {
         string result = controller.preSetShape(); // TODO The way to attach the object is still bad.
         if (!masterController.isDemo)
         {
             yield return(new WaitForSeconds(3));
         }
         if (masterController.isDemo)
         {
             yield return(new WaitForSeconds(5));
         }
     }
     else
     {
         controller.preSetShape();
         yield return(new WaitForSeconds(0));
     }
     controller.hydraTracker.attach();
     controller.activeChildren(true);
     controller.movePropDock(true);
     controller.objectGreen(false);
     controller.dockProp.SetActive(false);
     //yield return null;
 }
示例#3
0
        public AppearanceManager()
        {
            WeaponControllerBaseImpl = new WeaponController();
            _weaponController        = (WeaponController)WeaponControllerBaseImpl;

            WardrobeControllerBaseImpl = new WardrobeController(_weaponController.RemountWeaponInPackage);
            _wardrobeController        = (WardrobeController)WardrobeControllerBaseImpl;

            PropControllerBaseImpl = new PropController();
            _propController        = (PropController)PropControllerBaseImpl;

            ReplaceMaterialShaderBaseImpl = new ReplaceMaterialShader();
        }
示例#4
0
    public void setNew()
    {
        handOnObject = false;
        goal         = 0;
        for (int i = 0; i < 2; i++)
        {
            props[i].SetActive(false);
        }
        showing = false;
        stage   = -1;

        propContr      = null;
        triggerPressed = false;
    }
        public AppearanceManager()
        {
            WeaponControllerBaseImpl = new NewWeaponController();
            _weaponController        = (NewWeaponController)WeaponControllerBaseImpl;

            WeaponDataBaseImpl = new WeaponController();
            _weaponDataBase    = (WeaponController)WeaponDataBaseImpl;

            WardrobeControllerBaseImpl = new WardrobeController(_weaponController.RemountWeaponDueToBag);
            _wardrobeController        = (WardrobeController)WardrobeControllerBaseImpl;

            PropControllerBaseImpl = new PropController();
            _propController        = (PropController)PropControllerBaseImpl;

            ReplaceMaterialShaderBaseImpl = new ReplaceMaterialShader();
        }
示例#6
0
    public void Placer(string name)
    {
        PropMenu.SetActive(true);
        switch (name)
        {
        /*
         * PropController.create (StaticProps.Instance.toilet_2, 55, new Vector3(-90,0,0), 0.5F);
         * PropController.createOnWall (StaticProps.Instance.door_1, 9, new Vector3(0,90,180), -10, 1F);
         * PropController.createOnWall (StaticProps.Instance.mirror_1, 10, new Vector3(90,-90,90),5, -0.5F, 1F);
         */
        case "toilet":
            PropController.create(StaticProps.Instance.toilet, grid, new Vector3(-90, 0, -90), 0.5F);
            break;

        case "toilet_2":
            PropController.create(StaticProps.Instance.toilet_2, grid, new Vector3(-90, 0, 0), 0.5F);
            break;

        case "pouf":
            PropController.create(StaticProps.Instance.pouf, grid, new Vector3(-90, 0, 0), 0.5F);
            break;

        case "pouf_2":
            PropController.create(StaticProps.Instance.pouf_2, grid, new Vector3(-90, 0, 0), 0.5F);
            break;

        case "pouf_3":
            PropController.create(StaticProps.Instance.pouf_3, grid, new Vector3(-90, 0, 0), 0.5F);
            break;

        case "pouf_4":
            PropController.create(StaticProps.Instance.pouf_4, grid, new Vector3(-90, 0, 0), 0.5F);
            break;

        default:

            break;
        }
        PropMenu.SetActive(false);
        rotateButtonActive = true;
        FloorController.allowFloorClick = true;
    }
示例#7
0
        static int _m_AddCoin(RealStatePtr L)
        {
            try {
                ObjectTranslator translator = ObjectTranslatorPool.Instance.Find(L);


                HeroScoreComponent gen_to_be_invoked = (HeroScoreComponent)translator.FastGetCSObj(L, 1);



                {
                    float          _coinScore      = (float)LuaAPI.lua_tonumber(L, 2);
                    PropController _propController = (PropController)translator.GetObject(L, 3, typeof(PropController));

                    gen_to_be_invoked.AddCoin(_coinScore, _propController);



                    return(0);
                }
            } catch (System.Exception gen_e) {
                return(LuaAPI.luaL_error(L, "c# exception:" + gen_e));
            }
        }
示例#8
0
    // It controls ALL the movements. The trigger is actionated by the Master for each pressed trigger done by the user
    // To every task completly, it has to start in point Z (InitialStatus Object). The process as follow
    // Stage starts at 0.
    // If hand in initialstatus and trigger. Initialstatus object dissapears, the object to pick shows up. Stage = 0
    // When object picked, Second trigger shadow for next movement appears. Stage = 1
    // when object realeased, then trigger, shadows dissapear for pioint zero and appears in starts position. Stage = 2
    // When object in initial position and trigger objects dissapears and user move hand back to point zero. Stage = 3
    // When hand in initial position and trigger, movements ends. Stage = -1
    public void reGoal()
    {
        if (conditionsToProceed(stage))
        {
            if (stage == -1)
            {
                initialPoint.SetActive(true);
                stage = 0;
            }
            else if (stage == 0) // Hand in point Zero. Pre. No object to pick. Pos Object showed up initial position.
            {
                int nGoal;
                while ((nGoal = Random.Range(0, 2)) == goal)
                {
                    ;
                }

                goal = nGoal;
                //goal = 0;

                this.propContr = props[goal].GetComponent <PropController>();



                //TODO trackers. How mannage 3 trackers. This part should dissapear since all trackers should be in the scene so we should not need to look for the tracker everytime

                /* GameObject tracker1 = GameObject.Find("Tracker1");
                 * if(tracker1 != null)
                 * {
                 *   HydraTracker hTracker = tracker1.GetComponent<HydraTracker>();
                 *   if(hTracker != null)
                 *   {
                 *       //hTracker.attach(propContr);
                 *       hTracker.PositionReference = this.propContr;
                 *       if (masterController.currentStage != MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING)
                 *       {
                 *           hTracker.attach();
                 *       }
                 *
                 *   }
                 * }*/

                GameObject PositionReference = propContr.positionReference;
                targetedController.starShifting(PositionReference.transform.position, capsuleHand.GetLeapHand().PalmPosition.ToVector3()); //Capsulehand has a simplified methos for giving the hand. does not work here?
                if (masterController.currentStage == MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING || masterController.currentStage == MasterController.EXP_STAGE.PROP_NOT_MATCHING_PLUS_RETARGETING)
                {
                    props[goal].transform.position = targetedController.retargetedPosition.transform.position;
                }
                else
                {
                    props[goal].transform.position = PositionReference.transform.position;
                }
                StartCoroutine(pairTracker(1, this.propContr));

                persistanceManager.trackedObject = this.propContr;
                //props[goal].SetActive(true);
                persistanceManager.startDocking(stage);
                initialPoint.SetActive(false);
                stage = 1;
            }
            else if (stage == 1) // Hand in object Maybe should check the coliders are overlapped. Pre No shadow in scene. Pos shadow in point Z
            {
                persistanceManager.saveDocking();
                propContr.dockProp.SetActive(true);
                persistanceManager.startDocking(stage);
                stage = 2;
            }
            else if (stage == 2) // Object moved in desired position i point Z. Pre Shadow in point Z. Pos shadow in initial position
            {
                persistanceManager.saveDocking();
                propContr.movePropDock(false);
                persistanceManager.startDocking(stage);
                stage = 3;
            }
            else if (stage == 3) // Object moved to initial position in desired orientation. Pre. Shadow on, initial status off. Pos Shadow off, initial position on
            {
                persistanceManager.saveDocking();
                propContr.dockProp.SetActive(false);
                initialPoint.SetActive(true);
                persistanceManager.startDocking(stage);

                /*
                 * GameObject tracker1 = GameObject.Find("Tracker1");
                 * if (tracker1 != null)
                 * {
                 *  HydraTracker hTracker = tracker1.GetComponent<HydraTracker>();
                 *  if (hTracker != null)
                 *  {
                 *      //hTracker.attach(propContr);
                 *      hTracker.PositionReference = this.propContr;
                 *      if (masterController.currentStage != MasterController.EXP_STAGE.PROP_MATCHING_PLUS_RETARGETING)
                 *      {
                 *          hTracker.detach();
                 *      }
                 *
                 *  }
                 * }
                 */

                capsuleHand.canDraw = true;
                propContr.hydraTracker.detach();
                propContr.gameObject.SetActive(false);

                stage = 4;
            }
            else if (stage == 4) // Hand moves to point z
            {
                persistanceManager.saveDocking();
                persistanceManager.startDocking(stage);
                initialPoint.SetActive(false);
                capsuleHand.canDraw = true;
                stage = -1;
                propContr.hydraTracker.detach();
                if (!masterController.isDemo)
                {
                    if (propContr.angleNumber == 2)
                    {
                        notificationsMannager.registerGoal();
                    }
                }
            }

            notificationsMannager.lightStepNotification(stage + 2);
        }
    }
示例#9
0
 void spawnDefault()
 {
     PropController.create(StaticProps.Instance.modular_kitchen_table_1, "12", new Vector3(-90, 0, -90), 0.5F);
     PropController.create(StaticProps.Instance.modular_kitchen_table_1, "13", new Vector3(-90, 0, -90), 0.5F);
     PropController.create(StaticProps.Instance.cash_register, "13", new Vector3(-90, 0, 0), 8.5F);
 }
示例#10
0
 public PropFSM(PropController propController)
 {
     states.Add(PropController.AnimState.Start, new PropStartState(propController));
     states.Add(PropController.AnimState.Duration, new PropDurationState(propController));
     states.Add(PropController.AnimState.End, new PropEndState(propController));
 }
示例#11
0
 public PropEndState(PropController propController) : base(propController)
 {
 }
示例#12
0
 public PropDurationState(PropController propController) : base(propController)
 {
 }
示例#13
0
 public PropStartState(PropController propController) : base(propController)
 {
 }
示例#14
0
 public AbsPropState(PropController propController)
 {
     mPropController = propController;
 }
示例#15
0
    private void OnTriggerEnter2D(Collider2D collision)
    {
        if (collision.gameObject.GetComponent <Rigidbody2D>() != null)
        {
            if (!collision.gameObject.tag.Contains(alignment + ","))
            {
                if (autoCalckb)
                {
                    knockBackAngle = Vector2.Angle(new Vector2(transform.position.x, transform.position.y), new Vector2(collision.transform.position.x, collision.transform.position.y));
                }

                target = collision.gameObject;

                if (target.tag.Contains("Player,"))
                {
                    playerScript     = target.GetComponent <PlayerController>();
                    playerScript.Hp -= damage;
                    playerScript.HurtPlayer();
                    playerScript.IncomingKb = new Vector2(knockback, 0).Rotate(knockBackAngle);
                    playerScript.Invoke("ApplyKb", 0.01f);
                    GameObject particles = Instantiate(playerScript.hurtParticles);
                    particles.transform.position   = playerScript.transform.position;
                    particles.transform.localScale = new Vector3(particles.transform.localScale.x * playerScript.GetDir(), particles.transform.localScale.y, particles.transform.localScale.z);
                }
                else if (target.tag.Contains("Prop,"))
                {
                    propScript     = target.GetComponent <PropController>();
                    propScript.hp -= damage;
                }
                else if (target.tag.Contains("RedGolem,"))
                {
                    rGolemScript     = collision.gameObject.GetComponent <RedGolemController>();
                    rGolemScript.hp -= damage;
                    rGolemScript.SetHitStun();
                    rGolemScript.SetTargetObject(transform.parent.gameObject);
                    rGolemScript.IncomingKb = new Vector2(knockback, 0).Rotate(knockBackAngle);
                    rGolemScript.Invoke("ApplyKb", 0.01f);
                    GameObject particles = Instantiate(rGolemScript.hurtParticles);
                    particles.transform.position   = rGolemScript.transform.position;
                    particles.transform.localScale = new Vector3(particles.transform.localScale.x * rGolemScript.GetDir(), particles.transform.localScale.y, particles.transform.localScale.z);
                }
                else if (target.tag.Contains("GreenGolem,"))
                {
                    gGolemScript     = collision.gameObject.GetComponent <GreenGolemController>();
                    gGolemScript.hp -= damage;
                    gGolemScript.SetHitStun();
                    gGolemScript.SetTargetObject(transform.parent.gameObject);
                    gGolemScript.IncomingKb = new Vector2(knockback, 0).Rotate(knockBackAngle);
                    gGolemScript.Invoke("ApplyKb", 0.01f);
                    GameObject particles = Instantiate(gGolemScript.hurtParticles);
                    particles.transform.position   = gGolemScript.transform.position;
                    particles.transform.localScale = new Vector3(particles.transform.localScale.x * gGolemScript.GetDir(), particles.transform.localScale.y, particles.transform.localScale.z);
                }

                /*
                 *  -------------Template for What the added force is---------------------
                 * #use invoke to put a small delay to avoid bugs that involve controller and damage script running simutaneously
                 * otherRigid.AddForce(new Vector2(knockback, 0).Rotate(knockBackAngle), ForceMode2D.Impulse);
                 * */
                Physics2D.IgnoreCollision(range, collision);
            }
        }
    }