상속: MonoBehaviour
예제 #1
0
    private void Move()
    {
        var moveSpeed = runSpeed;

        if (playerInput.IsWalking)
        {
            moveSpeed = walkSpeed;
        }
        if (playerInput.IsSprinting)
        {
            moveSpeed = sprintSpeed;
        }
        if (playerInput.IsCrouched)
        {
            moveSpeed = crouchSpeed;
        }
        var direction = new Vector2(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed);

        MoveController.Move(direction);
        if (Vector3.Distance(transform.position, previousPosition) > minimumMoveTreshold)
        {
            footSteps.Play();
        }
        previousPosition = transform.position;
    }
예제 #2
0
    private void Move()
    {
        float speed = _runSpeed;

        bool isInCover = false;

        if (_playerStates.MoveState == PlayerStates.EMoveState.Covering)
        {
            isInCover = true;
        }

        if (_inputController.IsWalking)
        {
            speed = _walkSpeed;
        }
        if (_inputController.IsCrouching)
        {
            speed = _crouchSpeed;
        }
        if (_inputController.IsSprinting)
        {
            speed = _sprintSpeed;
        }
        if (isInCover)
        {
            speed = _coverSpeed;
        }

        // If we are in cover, we don't move vertically
        float   verticalDirection = isInCover ? 0 : _inputController.Vertical * speed;
        Vector2 direction         = new Vector2(verticalDirection, _inputController.Horizontal * speed);

        MoveController.Move(direction);
    }
예제 #3
0
 void Start()
 {
     _animator    = GetComponent <Animator>();
     _mController = GetComponent <MoveController>();
     direction    = 1;
     health       = 1000;
 }
예제 #4
0
 public void FollowLeader(MoveController leaderController, float minDistBehind)
 {
     Vector3 leaderDirection = leaderController.GetCurrentVelocity ().normalized;
     Vector3 leaderPos = leaderController.transform.position;
     Vector3 desiredPos = leaderPos - leaderDirection * minDistBehind;
     finalSteering += _Seek (desiredPos);
 }
예제 #5
0
    // Use this for initialization
    void Start()
    {
        player = GameObject.FindGameObjectWithTag("Player").transform;

        zero           = new Vector3(0, 0, 0);
        containerGame  = GameObject.FindGameObjectWithTag("GameController");
        gameController = containerGame.GetComponent <GameController>();

        containerScriptMove = GameObject.FindGameObjectWithTag("Player");
        scriptMove          = containerScriptMove.GetComponent <MoveController>();

        containerScriptAudioAlert = GameObject.FindGameObjectWithTag("GameController");
        ScriptAuidoAlert          = containerScriptAudioAlert.GetComponent <AudioAlert>();

        agent         = gameObject.GetComponent <NavMeshAgent>();
        ponto_1       = true;
        ponto_2       = false;
        ponto_central = false;

        if (PatrolPoints[0] == null)
        {
            ponto_1       = false;
            ponto_2       = false;
            ponto_central = true;
            anim.SetBool("iddle", true);
        }

        Patrol();
    }
        protected override void OnSendStart()
        {
            HighEffInfo highEffInfo = new HighEffInfo();

            if (this.targetUnits != null)
            {
                highEffInfo.unitIds = new List <short>();
                for (int i = 0; i < this.targetUnits.Count; i++)
                {
                    if (this.targetUnits[i] != null)
                    {
                        highEffInfo.unitIds.Add((short)this.targetUnits[i].unique_id);
                    }
                }
            }
            highEffInfo.ownerUnitId  = ((!(this.owner != null)) ? 0 : this.owner.unique_id);
            highEffInfo.casterUnitId = ((!(base.unit != null)) ? 0 : base.unit.unique_id);
            highEffInfo.rotatoY      = this.rotateY;
            highEffInfo.highEffId    = this.data.higheffId;
            highEffInfo.skillId      = this.skillId;
            if (this.skillPosition.HasValue)
            {
                highEffInfo.skillPosition = MoveController.Vector3ToSVector3(this.skillPosition.Value);
            }
            else
            {
                highEffInfo.skillPosition = MoveController.Vector3ToSVector3(Vector3.zero);
            }
            PvpEvent.SendDoHighEffEvent(highEffInfo);
        }
예제 #7
0
파일: Arena.cs 프로젝트: Beugeny/spreading
        public Arena(ArenaProperties props)
        {
            _state = new PopulationState();
            _state.StartPopulation = props.Population;

            _arenaRectTransform = props.ArenaObject.transform as RectTransform;
            if (_arenaRectTransform == null)
            {
                throw new Exception("_arenaRectTransform is null");
            }
            _moveController = new MoveController(_arenaRectTransform);


            _arenaRectTransform.sizeDelta = new Vector2(props.WorldWidth, props.WorldHeight);

            var rand = new Random();

            for (int i = 0; i < props.Population; i++)
            {
                var personProps = new PersonProperties();
                if (rand.NextDouble() > props.PercentAtIsolation)
                {
                    personProps.Speed = (float)(props.PersonSpeed + rand.NextDouble() * props.PersonSpeed);
                }
                else
                {
                    personProps.Speed = 0;
                }

                personProps.PersonPrefab = props.PersonObject;
                var person = ArenaUtils.CreatePerson(personProps, _arenaRectTransform);
                _persons.Add(person);
            }
        }
예제 #8
0
    // Start is called before the first frame update
    void Start()
    {
        Initiate_params();

        for (int i = 0; i < nball; i++)
        {
            GameObject newBall = Instantiate(Ballpref);
            newBall.transform.localScale = new Vector3(diameter, diameter, diameter);
            MoveController ballscript = newBall.GetComponent <MoveController>();
            balls.Add(newBall.gameObject);
            ballscripts.Add(ballscript);
        }

        for (int i = 0; i < 2; i++)
        {
            GameObject newString = Instantiate(Stringpref);
            newString.transform.localScale = new Vector3(10.0f, 10.0f, 10.0f);
            MoveString stringscript = newString.GetComponent <MoveString>();
            strings.Add(newString.gameObject);
            stringscripts.Add(stringscript);
        }

        Initiate_xv();
        Get_xv();
        UpdatePos();
    }
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
     animator = GetComponent<Animator>();
     health = GetComponent<Health>();
     deathPlayed = false;
 }
예제 #10
0
    void Awake()
    {
        // 컴포넌트 연결
        playerHealth   = GetComponent <PlayerHealth>();
        moveController = GetComponent <MoveController>();
        gun            = GetComponent <PlayerShooter>().gun;

        // 초기 현재값설정
        CStats.CurrentHealth      = CStats.InitialHealth;
        CStats.CurrentProtectRate = CStats.InitialProtectRate;
        CStats.CurrentDamage      = CStats.InitialDamage;
        CStats.CurrentSpeed       = CStats.InitialSpeed;

        // 조종하는 케릭터값 전달
        if (photonView.IsMine)
        {
            GameManager.Instance.Player       = gameObject;
            GameManager.Instance.PlayerViewID = gameObject.GetPhotonView().ViewID;

            ItemManager.Instance.Player   = gameObject;
            ItemManager.Instance.PlayerPV = gameObject.GetPhotonView();

            UIManager.Instance.Player = gameObject;

            NetworkManagerInGame.Instance.clientPlayer = gameObject;
        }
    }
예제 #11
0
    void Move()
    {
        float moveSpeed = runSpeed;

        if (playerInput.IsWalking)
        {
            moveSpeed = walkSpeed;
        }
        if (playerInput.IsSprinting && Thirsty > 0f)
        {
            moveSpeed = sprintSpeed;
        }
        if (playerInput.IsCrouched)
        {
            moveSpeed = crouchSpeed;
        }



        Vector2 direction = new Vector2(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed);

        MoveController.Move(transform.forward * direction.x * .02f + transform.right * direction.y * .02f);

        if (Vector3.Distance(transform.position, previousPosition) > minimumMoveTreshold)
        {
            footSteps.Play();
        }

        previousPosition = transform.position;
    }
예제 #12
0
        private IEnumerator SetMaterial()
        {
            yield return(null);

            //判断如果是乌龟就调整参数要不会出现效果不正的问题
            if (m_VariantName.Contains("M067"))
            {
                Renderer[] renderers = m_Character.GetComponentsInChildren <Renderer>();
                for (int i = 0; i < renderers.Length; i++)
                {
                    if (renderers[i].gameObject.name.Contains("M067_Body"))
                    {
                        renderers[i].material.SetFloat("_SpecularPower", 17.0f);
                    }
                }
            }
            //如果是两大BOSS的话~就调Salse要不,太大了
            if (m_VariantName.Contains("M067") || m_VariantName.Contains("M025"))
            {
                mDMono.transform.localPosition = Vector3.zero;
                mDMono.transform.localScale    = Vector3.one * 0.342f;
                mDMono.transform.localRotation = Quaternion.Euler(0, 2, 0);

                MoveController moveController = mDMono.gameObject.GetComponentInChildren <MoveController>();
                while (!moveController.IsInitialized)//等待MoveController初始化完成,不然会报错
                {
                    yield return(null);
                }
                moveController.TransitionTo(MoveController.CombatantMoveState.kReady);
            }
        }
예제 #13
0
 public void start()
 {
      x = new Vector2(0, 0);
      t = 10;
      moveController = GetComponent<MoveController>();
      GetComponent<Rigidbody2D>().mass = 5;
 }
예제 #14
0
        public override List <Field> GetAccessibleFields()
        {
            var list = MoveController.GetAccessibleFieldsBishop(Board, this);

            list.AddRange(MoveController.GetAccessibleFieldsRook(Board, this));
            return(list);
        }
예제 #15
0
 /// <summary>
 /// Does all the initialization that cannot be done when the instance is being created.
 /// (Controllers may need Game to be initialized already which needs instances of players)
 /// </summary>
 public void Init(PlacementController placerNetwork, MoveController moveController, KillController killController, FlyingController flyingController)
 {
     this.placerNetwork    = placerNetwork;
     this.moveController   = moveController;
     this.killController   = killController;
     this.flyingController = flyingController;
 }
예제 #16
0
    private BoatController boatRoleController;                                  //船控制器

    //导入资源
    public void LoadResources()
    {
        //初始化
        roleModelControllers = new RoleModelController[6];
        for (int i = 0; i < 6; i++)
        {
            roleModelControllers[i] = new RoleModelController();
            roleModelControllers[i].CreateRole(PositionModel.roles[i], i < 3 ? true : false, i);
        }

        leftLandRoleController = new LandModelController();
        leftLandRoleController.CreateLand("left_land", PositionModel.left_land);
        rightLandRoleController = new LandModelController();
        rightLandRoleController.CreateLand("right_land", PositionModel.right_land);
        foreach (RoleModelController roleModelController in roleModelControllers)
        {
            roleModelController.GetRoleModel().role.transform.localPosition = leftLandRoleController.AddRole(roleModelController.GetRoleModel());
        }
        riverModel         = new RiverModel(PositionModel.river);
        boatRoleController = new BoatController();
        boatRoleController.CreateBoat(PositionModel.left_boat);
        moveController = new MoveController();
        isRuning       = true;
        time           = 60;
    }
예제 #17
0
    //--------------------------------
    // 3 - Tirer depuis un autre script
    //--------------------------------

    /// <summary>
    /// Création d'un projectile si possible
    /// </summary>
    public void Attack(bool isEnemy)
    {
        if (CanAttack)
        {
            shootCooldown = shootingRate;

            // Création d'un objet copie du prefab
            var shotTransform = Instantiate(shotPrefab) as Transform;

            // Position
            shotTransform.position = transform.position;

            // Propriétés du script
            PlayerShotController shot = shotTransform.gameObject.GetComponent <PlayerShotController>();
            if (shot != null)
            {
                shot.isEnemyShot = isEnemy;
            }

            // On saisit la direction pour le mouvement
            MoveController move = shotTransform.gameObject.GetComponent <MoveController>();
            if (move != null)
            {
                move.direction = this.transform.right; // ici la droite sera le devant de notre objet
            }
        }
    }
예제 #18
0
 protected void SetNeedToTransitionToIdle(GameObject character, bool needToTransitionToIdle)
 {
     if (character != null)
     {
         PlayerEquipmentDataLookup lookup = character.GetDataLookupILRComponent <PlayerEquipmentDataLookup>("Hotfix_LT.UI.PlayerEquipmentDataLookup", false);
         if (lookup == null)
         {
             MoveController mc = character.GetComponent <MoveController>();
             if (mc != null && mc.GetMoveByState(MoveController.CombatantMoveState.kLobby) != null)
             {
                 System.Action fn = () =>
                 {
                     lookup = character.AddDataLookupILRComponent <PlayerEquipmentDataLookup>("Hotfix_LT.UI.PlayerEquipmentDataLookup");
                     lookup.needToTransitionToIdle = needToTransitionToIdle;
                 };
                 if (!mc.IsInitialized)
                 {
                     mc.RegisterInitSuccCallBack(fn);
                 }
                 else
                 {
                     fn();
                 }
             }
         }
         else
         {
             lookup.needToTransitionToIdle = needToTransitionToIdle;
         }
     }
 }
예제 #19
0
    public bool hasStarted = false; // set when first passenger is instanciated

    public IEnumerator LaunchPassengers(GridHelper dataGridHelper)
    {
        yield return(new WaitForSeconds(2));

        spawnDelay = spawnDelayStart;

        //makes sure they match length
        for (int i = 0; i < totalPassengers; i++)
        {
            spawnDelay = spawnDelayStart;

            GameObject passengerInstance = Instantiate(passenger, new Vector3(startPosition.position.x, startPosition.position.y, startPosition.position.z), Quaternion.identity) as GameObject;

            // pass the DataGridHelper to the passenger MoveController
            MoveController moveController = passengerInstance.GetComponent <MoveController>();
            moveController.gridHelper = dataGridHelper;

            if (i == totalPassengers - 1)
            {
                moveController.lastOne = true;
            }

            // save the new instance in the list
            passengersList.Add(passengerInstance);

            hasStarted = true;

            yield return(new WaitForSeconds(spawnDelay));
        }
    }
예제 #20
0
    public void LoadResources()
    {
        SrcCoastController = new CoastController();
        SrcCoastController.CreateCoast("src_coast", PositionModel.src_coast);
        DesCoastController = new CoastController();
        DesCoastController.CreateCoast("des_coast", PositionModel.des_coast);

        boatController = new BoatController();
        boatController.CreateBoat(PositionModel.boat_on_left);

        roleModelControllers = new RoleController[6];
        for (int i = 0; i < 3; i++)
        {
            roleModelControllers[i] = new RoleController();
            roleModelControllers[i].CreateRole(PositionModel.roles[i], 0, i);
        }
        for (int i = 3; i < 6; i++)
        {
            roleModelControllers[i] = new RoleController();
            roleModelControllers[i].CreateRole(PositionModel.roles[i], 1, i);
        }

        foreach (RoleController roleModelController in roleModelControllers)
        {
            roleModelController.GetRoleModel().role.transform.localPosition = SrcCoastController.AddRole(roleModelController.GetRoleModel());
        }

        moveController = new MoveController();

        river = new RiverModel(PositionModel.river);

        isRuning = true;
        time     = 120;
    }
예제 #21
0
    protected virtual void OnInitialize()
    {
        //IL_009d: Unknown result type (might be due to invalid IL or missing references)
        //IL_00a8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00ad: Unknown result type (might be due to invalid IL or missing references)
        //IL_00b2: Unknown result type (might be due to invalid IL or missing references)
        //IL_00c8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d3: Unknown result type (might be due to invalid IL or missing references)
        //IL_00d8: Unknown result type (might be due to invalid IL or missing references)
        //IL_00dd: Unknown result type (might be due to invalid IL or missing references)
        opponentMem           = new OpponentMemory(this);
        targetCtrl            = new TargetController(this);
        moveCtrl              = new MoveController(this);
        weaponCtrl            = new WeaponController(this);
        opponentMemSpanTimer  = new SpanTimer(param.thinkParam.opponentMemorySpan);
        targetUpdateSpanTimer = new SpanTimer(param.thinkParam.targetUpdateSpan);
        _frontTransform       = GetFront();
        _backTransform        = GetBack();
        rootInternalRedius    = param.sensorParam.internalRadius * GetScale();
        Vector2 val = frontPositionXZ - owner.positionXZ;

        rootFrontDistance = val.get_magnitude() - rootInternalRedius;
        Vector2 val2 = backPositionXZ - owner.positionXZ;

        rootBackDistance = val2.get_magnitude() - rootInternalRedius;
    }
예제 #22
0
 private void Recharge(MoveController moveController)
 {
     if (turnsToRecharge > 0)
     {
         turnsToRecharge--;
     }
 }
예제 #23
0
    private void Move()
    {
        float moveSpeed = runSpeed;

        //change speed according use state
        if (playerInput.IsWalking)
        {
            moveSpeed = walkSpeed;
        }
        if (playerInput.IsSprinting)
        {
            moveSpeed = sprintSpeed;
        }



        Vector2 direction = new Vector2(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed);

        MoveController.Move(direction);
        if (Vector3.Distance(transform.position, previousPosition) > minimumMoveTreshold)
        {
            footSteps.play();
        }


        previousPosition = transform.position;
    }
    private void Awake()
    {
        Application.targetFrameRate = 60;

        _moveController = GetComponent <MoveController>();
        _gridRenderer   = GetComponent <GridRenderer>();
    }
예제 #25
0
 void Start()
 {
     try
     {
         status        = FindObjectOfType <PlayerManager>().Status;
         player_ctr    = GameObject.Find("Controller").GetComponent <PlayerController>();
         move_ctr      = GameObject.FindObjectOfType <MoveController>();
         crossAxisdown = move_ctr.gameObject.GetComponent <CrossAxisDown>();
         alchemy_ctr   = GameObject.FindObjectOfType <AlchemyController>();
         alchemyText   = gameObject.GetComponent <AlchemyText>();
         ChooseObj     = gameObject.transform.Find("ThrowChoose").gameObject;
         ChooseObj.SetActive(false);
         ItemFrame    = gameObject.transform.Find("SelectFrame").gameObject;
         PotFrame     = gameObject.transform.Find("AlchemyPotFrame").gameObject;
         mtr_0        = PotFrame.transform.Find("AlchemyPotin/Material/material_0").gameObject.transform.GetChild(0).gameObject;
         mtr_1        = PotFrame.transform.Find("AlchemyPotin/Material/material_1").gameObject.transform.GetChild(0).gameObject;
         AlphaSprite  = Resources.Load <Sprite>("Textures/UI/AlphaImage");
         SuccessPanel = gameObject.transform.Find("Alchemy_Succes").gameObject;
     }
     catch (Exception e)
     {
         Debug.LogWarning(e + "がないよ!");
     }
     nowAlchemyItem = 0;
     nowBox         = 0;
     beforeNowBox   = -1;
     _chooseWindow  = false;
     setItembox();
     setItemImageList();
     StartCreateItemBox();
     Box_item = new GameObject[Itembox.Length];
     ClearJoystickRotation();
     Materials_item.Clear();
 }
예제 #26
0
 // puts us into the animation state we require, if character is able to make the transition right now
 public void SetDesiredAnimationState(global::MoveController.CombatantMoveState stateDesired)
 {
     if (MoveController != null)
     {
         MoveController.SetDesiredState(stateDesired);
     }
 }
    public void MovePlayer(PlayerPosition playerPosition)
    {
        GameObject     player         = players.Find(p => p.GetComponent <PlayerManager>().ID == playerPosition.Id);
        MoveController moveController = player.GetComponent <MoveController>();

        moveController.CalculateMoveInGrid(playerPosition);
    }
예제 #28
0
 void Awake()
 {
     controller = GetComponent <MoveController>();
     render     = GetComponentInChildren <SpriteRenderer>();
     bCollider  = GetComponent <BoxCollider2D>();
     anim       = GetComponent <Animator>();
 }
        private void StartStage(Stage stage)
        {
            MoveController moveController = stage.PlayerEntity.GetComponent <MoveController>();

            moveController.OnActionSelected   += HighlightTargets;
            moveController.OnActionDeselected += RemoveHighlights;
        }
예제 #30
0
 // Use this for initialization
 void Start()
 {
     try
     {
         pManager      = FindObjectOfType <PlayerManager>();
         status        = pManager.Status;
         alchemy_ctr   = FindObjectOfType <AlchemyController>();
         alchemyUI_ctr = GameObject.Find("Canvas/Alchemy_UI").GetComponent <AlchemyUIController>();
         BrotherObj    = FindObjectOfType <MoveController>().gameObject;
         move_ctr      = BrotherObj.GetComponent <MoveController>();
         PotObject     = FindObjectOfType <PotController>().gameObject;
         createItemBox = new List <CreateItemStatus.Type>();
         anim_ctr      = BrotherObj.transform.parent.GetComponent <AnimController>();
         lifePoint     = GameObject.FindGameObjectWithTag("LifePoint");
     }
     catch (UnityException e)
     {
         Debug.Log(e + " is NotFound");
     }
     StartHeart();
     setStartSwordList();
     //剣のデバッグ
     //swordList[1] = PlayerStatus.SWORDTYPE.AXE;
     //swordList[2] = PlayerStatus.SWORDTYPE.DARK;
     //swordList[3] = PlayerStatus.SWORDTYPE.VAJURA;
     _itemMax      = false;
     alchemyUIFlag = false;
 }
예제 #31
0
    // Update is called once per frame
    void Update()
    {
        if (!playerDead && !GameManagers.Instance.GameState.IsPaused())
        {
            if (playerInput == null)
            {
                Debug.Log("PlayerInput is null");
            }
            Vector2 direction = new Vector2(playerInput.Vertical * speed, playerInput.Horizontal * speed);



            MoveController.Move(direction);

            if (Vector3.Distance(transform.position, lastFramePos) > minimumMoveThreshold)
            {
                footsteps.Play();
            }

            mouseInput.x = Mathf.Lerp(mouseInput.x, playerInput.MouseInput.x, 1f / MouseControl.Damping.x);
            mouseInput.y = Mathf.Lerp(mouseInput.y, playerInput.MouseInput.y, 1f / MouseControl.Damping.y);


            transform.Rotate(Vector3.up * mouseInput.x * MouseControl.Senstivity.x * Time.deltaTime);

            Crosshair.LookHeight(mouseInput.y * MouseControl.Senstivity.y * Time.deltaTime);
            playeraim.SetRotation(mouseInput.y * MouseControl.Senstivity.y * Time.deltaTime);

            lastFramePos = transform.position;
            GameManagers.Instance.InputMan.mouseControl.TouchDist = Vector3.zero;
        }
    }
예제 #32
0
 private void TickCooldown(MoveController moveController)
 {
     if (remainingCooldown > 0)
     {
         remainingCooldown--;
     }
 }
예제 #33
0
    void Move()
    {
        float moveSpeed = settings.RunSpeed;

        if (playerInput.IsJumping)
        {
            if (playerInput.IsWalking)
            {
                moveSpeed = settings.WalkSpeed;
            }
        }

        if (playerInput.IsSprinting)
        {
            moveSpeed = settings.SprintSpeed;
        }

        if (playerInput.IsCrouching)
        {
            moveSpeed = settings.CrouchSpeed;
        }

        Vector3 direction = new Vector3(playerInput.Vertical * moveSpeed, playerInput.Horizontal * moveSpeed);

        MoveController.SimpleMove(transform.forward * direction.x + transform.right * direction.y);


        if (Vector3.Distance(transform.position, lastPosition) > minimumMoveTreshold)
        {
            footSteps.Play();
        }

        lastPosition = transform.position;
    }
예제 #34
0
	public void AddController(MoveController controller){
		if(Application.platform != RuntimePlatform.OSXEditor) return;
		
		_controllers.Add(controller);

		controller.Controller.ControllerId = (ControllerId) Controllers.Count;
		controller.Controller.OnEvent = OnControllerGestureHandler;
	}
예제 #35
0
파일: Ship.cs 프로젝트: torston/Asteroids
 private void Awake()
 {
     moveController  = gameObject.AddComponent<MoveController>();
     cachedTransform = transform;
     cachedRenderer = GetComponent<Renderer>();
     cachedRigitbody = GetComponent<Rigidbody2D>();
     cachedCollider = GetComponent<Collider2D>();
 }
예제 #36
0
 //Create hp bars for players and bosses
 // Use this for initialization
 void Start()
 {
     player = FindObjectOfType<Player>(); //find player
     enemy = GetComponent<Boss>();
     moveController = GetComponent<MoveController>();
     damageTextOffset = new Vector3(0, 2, 0);
     currentHealth = maxhp; //+ player.getLevel()/3
     Update_Maxhp();
 }
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
     animator = GetComponent<Animator>();
     attackController = GetComponent<AttackController>();
     crowdControllable = GetComponent<CrowdControllable>();
     health = GetComponent<Health>();
     player = GetComponent<Player>();
 }
예제 #38
0
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
       s1_CD = s2_CD = 3;
       s3_CD = 5;
       s4_CD = 8;
       s5_CD = 12;
       pos = new Vector3(transform.position.x, -2.196465f, transform.position.z);
 }
예제 #39
0
    void Awake()
    {
        sheathSwordWaitTime = 0.5f;
        moveController = GetComponent<MoveController> ();
        anim = GetComponent<Animator> ();
        engagedIntoBattle = false;
        hash = GameObject.FindGameObjectWithTag(Tags.gameController).GetComponent<HashIDs>();
        rb = GetComponent<Rigidbody2D> ();

        anim.SetBool (hash.sword, true);
    }
예제 #40
0
 public MoveController ChangeController(MoveController ctrl)
 {
     MoveController oldCtrl = _currMoveController;
     _currMoveController = ctrl;
     Vector3 initPos;
     Quaternion initRot;
     _currMoveController.Init(out initPos, out initRot);
     transform.position = initPos;
     transform.rotation = initRot;
     return oldCtrl;
 }
예제 #41
0
    public void GeneralStart()
    {
        handController = new HandController ();
        moveController = new MoveController ();
        leftCardPosition = new Vector3(transform.position.x - 0.5f,transform.position.y  - 0.5f,transform.position.z);
        rightCardPosition = new Vector3(transform.position.x + 0.5f,transform.position.y  - 0.5f,transform.position.z);

        var timeCard = (GameObject)Instantiate (Card, leftCardPosition, Quaternion.identity);
        leftCard = timeCard.GetComponent<CardBasicScript> ();
        timeCard = (GameObject)Instantiate (Card, rightCardPosition, Quaternion.identity);
        rightCard = timeCard.GetComponent<CardBasicScript> ();
    }
예제 #42
0
	void Awake()
	{
		mc = GetComponent<MoveController> ();
		ac = GetComponent<AttackController> ();
		tm = GetComponent<TeamMember> ();
		hp = GetComponent<Health> ();
		xp = GetComponent<Experience> ();
		an = GetComponent<Animator> ();
		rb = GetComponent<Rigidbody2D> ();
		sr = GetComponent<SpriteRenderer> ();
		bc = GetComponent<BoxCollider2D> ();

	}
예제 #43
0
    static PSMoveInput()
    {
        MoveControllers = new MoveController[MAX_MOVE_NUM];
        NavControllers = new NavController[MAX_NAV_NUM];

        for(int i = 0; i < MAX_MOVE_NUM; ++i) {
            MoveControllers[i] = new MoveController(i);
        }
        for(int i = 0; i < MAX_NAV_NUM; ++i) {
            NavControllers[i] = new NavController(i);
        }

        imageTex =  new Texture2D(0,0);
        finalImage = new List<Color32>();
    }
예제 #44
0
	// Update is called once per frame
	void Update () {
        controller = moveServer.getController(0);
        if (controller != null) {
            triggerValue = controller.triggerValue;
            position = controller.getPositionRaw();
            rotationAngles = controller.getQuaternion().eulerAngles;

            GameObject.FindGameObjectWithTag("ControllerInfo").GetComponent<UnityEngine.UI.Text>().text = "Controller " + controller.controllerNumber + "\n" +
                "Position: " + "(" + position.x + ", " + position.y + ", " + position.z + ")\n" +
                "Rotation (by axes): " + "(" + rotationAngles.x + ", " + rotationAngles.y + ", " + rotationAngles.z + ")\n" +
                "Trigger Value: " + triggerValue;
        }
        else {
            GameObject.FindGameObjectWithTag("ControllerInfo").GetComponent<UnityEngine.UI.Text>().text = "Controller not connected.";
        }
        
	}
예제 #45
0
	// Use this for initialization
	void Start () {
	    checkIfGrounded = true;
		//healthBar = GameObject.FindGameObjectWithTag ("HP Bar").GetComponent<ENPCHealthBar> ();
        _rigidBody = GetComponent<Rigidbody2D>();
        am = GameObject.FindGameObjectWithTag("AudioManager").GetComponent<AudioManager>();
        isBeingDamaged = false;
		startPosition = new Vector3 (transform.position.x, transform.position.y + 3);
		Health = 100;
		MaxHealth = Health;
		soundPlaying = false;
	    run.volume = 0.4f;
		CanJump = false;
		CanAttack = true;
		CanMove = true;
		treasureText = GameObject.FindGameObjectWithTag ("TreasureText").GetComponent<Text>();
		KlugMove = GetComponent<Animator> ();
        

        if (Stats.SpawnLocation != Vector3.zero) {
			transform.position = Stats.SpawnLocation;
		}

	    if (Application.loadedLevelName.Equals("Village")) {
	        treasureText.text = Stats.TotalTreasure.ToString();
	    }

	    //#if PRODUCTION
        #if PRODUCTION
				slashController = PSMoveInput.MoveControllers [0];
				attackController = PSMoveInput.MoveControllers [1];

				if(!PSMoveInput.IsConnected) {
			Stats.Connect();
		}
		#endif
	}
예제 #46
0
        // Use this for initialization
        void Start()
        {
            if(isLocalPlayer)
            {
                mvCtrl = gameObject.AddComponent<MoveController>();
            }

            if(isServer)
            {
                ServerSyncMgr.Inst.Register(this);
                charCtrl = GetComponent<CharacterController>();
            }
        }
예제 #47
0
        void SendTransform()
        {
            if(NetworkClientMgr.Client == null)
            {
                //TODO RECONNECT
                return;
            }

            if(mvCtrl == null)
            {
                mvCtrl = gameObject.AddComponent<MoveController>();
            }

            MsgSyncTransform msg = new MsgSyncTransform();
            msg.netId = netId;
            mvCtrl.GetTransform(out msg.pos, out msg.velocity, out msg.rot, out msg.timeStamp);

            NetworkClientMgr.Client.SendByChannel(MsgConsts.MSG_TRANSFORM_SYNC, msg, NetworkMgr.CHANNEL_UNRELIABLE);
        }
예제 #48
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag("Player").GetComponent<Transform>();
     my = GetComponent<Transform>();
     move = GetComponent<MoveController>();
 }
	void Start()
	{
		_playerAnim = GetComponent<AnimController>();
		_playerMovement = GetComponent<MoveController>();
	}
    // Update is called once per frame
    void Update()
    {
        if (PSMoveInput.IsConnected == true) {
            controller = PSMoveInput.MoveControllers[index];
            moveData = controller.Data;

            if (controller.Connected == true && moveData != null) {
                string buttonsSt = ""+moveData.Buttons;

                bool isTriggerDown = moveData.Buttons == MoveButton.T || (psMoveWraper.gyroEnabled && psMoveWraper.gyroAnalogScale && moveData.ValueT >= psMoveWraper.gyroAnalogMin);

                if(moveData.Buttons == MoveButton.Start && isCalibrationEnabled == true){
                    isCalibrationEnabled = false;
                    LeanTween.delayedCall(1f,()=>{
                        isCalibrationEnabled = true;
                    });
                    psMoveWraper.CalibratePlayer(index);

                }
                else if ((buttonsSt == "Square, T" || buttonsSt == "T, Square" || moveData.Buttons == MoveButton.Square) && curShape != Shape.SQUARE && snapState == SnapState.UnsnappedAndSnappable) {
                    changeShape(Shape.SQUARE);
                }
                else if ((buttonsSt == "Triangle, T" || buttonsSt == "T, Triangle" || moveData.Buttons == MoveButton.Triangle) && curShape != Shape.TRIANGLE && snapState == SnapState.UnsnappedAndSnappable) {
                    changeShape(Shape.TRIANGLE);

                }
                else if ((buttonsSt == "Circle, T" || buttonsSt == "T, Circle" || moveData.Buttons == MoveButton.Circle) && curShape != Shape.CIRCLE && snapState == SnapState.UnsnappedAndSnappable) {
                    changeShape(Shape.CIRCLE);

                }
                else if ((buttonsSt == "Cross, T" || buttonsSt == "T, Cross" || moveData.Buttons == MoveButton.Cross) && curShape != Shape.CROSS && snapState == SnapState.UnsnappedAndSnappable) {
                    changeShape(Shape.CROSS);

                }
                else if (isTriggerDown) {
                    if(!playedTriggerSound) {
                        AudioManager.Main.PlayNewSound("Puzzle_lock");
                        playedTriggerSound = true;
                    }

                    // Update border particles
                    if (!GetComponent<ParticleManager> ().IsPlaying () && this.snapState != SnapState.SnappedAndUnsnappable) {
                        GetComponent<ParticleManager> ().Play ();
                    } else if (GetComponent<ParticleManager> ().IsPlaying () && this.snapState == SnapState.SnappedAndUnsnappable) {
                        GetComponent<ParticleManager> ().Stop ();
                    }

                    if (!psMoveWraper.gyroEnabled) {

                        Vector3 curScale = gameObject.transform.localScale;
                        if(prevZPosition == 0f){
                            prevZPosition = (float) Math.Round((double)moveData.Position.z, 1) ;
                            isRaisingScale = 0;
                        }

                        float curZPosition = (float) Math.Round((double)moveData.Position.z, 1) ;

                        if(curZPosition > prevZPosition){
                            isRaisingScale = 1;
                        }
                        else if(curZPosition < prevZPosition){
                            isRaisingScale = -1;
                        }
                        else{
                            isRaisingScale = 0;
                        }

                        prevZPosition = (float) Math.Round((double) moveData.Position.z, 1);

                        if(isRaisingScale == 1){
                            gameObject.transform.localScale = new Vector3(minScale,minScale,minScale) * Mathf.Clamp(curScale.x + (Time.deltaTime*scaleSpeed),minScale,maxScale);

                        }
                        else if(isRaisingScale == -1){
                            gameObject.transform.localScale = new Vector3(minScale,minScale,minScale) * Mathf.Clamp(curScale.x - (Time.deltaTime*scaleSpeed),minScale,maxScale);

                        }
                        else{
                            isRaisingScale = 0;
                        }
                    }
                }
                else{
                    isRaisingScale = 0;
                    playedTriggerSound = false;
                    if(snapState == SnapState.SnappedAndUnsnappable)
                    {
                        if(moveData.ValueT == 0 && psMoveWraper.isHandleActive[index] == false){
                            snapState = SnapState.UnsnappedAndUnsnappable;
                            enablePlayer();

                        }
                    }

                }

                // Update border particles
                if (!isTriggerDown && GetComponent<ParticleManager>().IsPlaying())
                    GetComponent<ParticleManager>().Stop();

            }
        }

        if( ((Input.GetKey(KeyCode.Keypad1) == true || Input.GetKey(KeyCode.Alpha1) == true) && index == 0) || ((Input.GetKey(KeyCode.Keypad2) == true || Input.GetKey(KeyCode.Alpha2) == true) && index == 1) || ((Input.GetKey(KeyCode.Keypad3) == true || Input.GetKey(KeyCode.Alpha3) == true) && index == 2)){
            checkKeyboardControls();

        }
    }
예제 #51
0
	// Use this for initialization
	void Start () {
        controller = moveServer.getController(0);
	}
예제 #52
0
    void Start()
    {
        GameObject levelControllerObject = GameObject.FindWithTag ("LevelController");
        if (levelControllerObject != null)
            lvlC = levelControllerObject.GetComponent <LevelController>();
        else
            Debug.Log ("Cannot find 'LevelController' script");

        move=GetComponent<MoveController>();

        //initialisaiton du chemin.
        if(points!=null)
        {
            nbPoints=points.Length;
            target=points[0].position;
            iPoint=1;
            goTo(target);
        }
    }
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
     animator = GetComponent<Animator>();
 }
예제 #54
0
    void Start()
    {
        state = new StandingState();
        attackState = new IdleAttackState();
        animator = GetComponent<Animator>();
        AttackCollider.SetActive(false);
        health = GetComponent<Health>();
        controller = GetComponent<MoveController>();
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2) / 3;
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        print("Gravity: " + gravity + "  Jump Velocity: " + jumpVelocity);

        initialRegenTime = 6;
        regenTick = 2;

        knockBackResistance = 10;
        knockBackCounter = 0;
        knockBackReset = 0;

        flinchResistance = 10;
        flinchCounter = 0;
        flinchReset = 0;

        text = GameObject.Find("HealthText").GetComponent<Text>();
        text.text = text.GetComponent<Score>().modX(0).ToString();
        blink = false;
        blinkTime = 0;
    }
예제 #55
0
 // Use this for initialization
 void Start()
 {
     moveController = this.GetComponent<MoveController> ();
     anim = this.GetComponent<Animator> ();
     if (targetObj != null)
         targetMoveController = targetObj.GetComponent<MoveController> ();
     if (thisBehavior == DogBehavior.SeekAStar3D) {
         moveController.Set3D (true);
     }
 }
예제 #56
0
 // Use this for initialization
 void Start()
 {
     isInvincible = false;
     hitSound = Resources.Load("hurt2") as AudioClip;
     player = GetComponent<Player>();
     moveController = GetComponent<MoveController>();
     crowdControllable = GetComponent<CrowdControllable>();
     currentHealth = maxhp;
     damageTextOffset = new Vector3(0, 2, 0);
 }
 void Start()
 {
     move = GetComponent<MoveController>();
 }
예제 #58
0
 // Use this for initialization
 void Start()
 {
     player = GameObject.FindGameObjectWithTag ("Player").transform;
     moveController = this.GetComponent<MoveController> ();
     anim = this.GetComponent<Animator> ();
     if (targetObj != null)
         targetMoveController = targetObj.GetComponent<MoveController> ();
     if (thisBehavior == DogBehavior.SeekAStar3D) {
         moveController.Set3D (true);
     }
 }
예제 #59
0
    /*
    void Awake()
    {
        if (player == null)
        {
            player = gameObject;
        }else if(player != gameObject)
        {
            Destroy(gameObject);
        }
    }*/
    void Start()
    {
        state = new StandingState();
        attackState = new IdleAttackState();
        animator = GetComponent<Animator>();
        skillManager = gameObject.AddComponent<SkillManager>();
        AttackCollider.SetActive(false);
        health = GetComponent<Health>();
        controller = GetComponent<MoveController>();
        crowdControllable = GetComponent<CrowdControllable>();
        mana = GetComponent<Mana>();
        attack = GetComponentInChildren<DealDamage>();
        defense = GetComponent<Defense>();
        attackController = GetComponent<AttackController>();
        gravity = -(2 * jumpHeight) / Mathf.Pow(timeToJumpApex, 2);
        jumpVelocity = Mathf.Abs(gravity) * timeToJumpApex;
        audiosource = GetComponent<AudioSource>();

        initialRegenTime = 6;
        regenTick = 2;

        DontDestroyOnLoad(gameObject);

        skill[0] = null;
        skill[1] = null;
        skill[2] = null;
        skill[3] = null;
        threatLevel = damageDealt = 0;

        GetComponent<ID>().setTime(false);
        CCI = GameObject.Find("Main Process").GetComponentInChildren<Character_Class_Info>();
        si = GameObject.Find("Main Process").GetComponentInChildren<Skill_info>();
        Fully_Update();
    }
예제 #60
0
 //Create hp bars for players and bosses
 // Use this for initialization
 void Start()
 {
     moveController = GetComponent<MoveController>();
     currentHealth = startingHealth;
 }