void Start() { GameObject modelGo = Instantiate(availableModels[modelIndex], transform.position, transform.rotation, transform); PlayerGFX model = modelGo.GetComponent <PlayerGFX>(); if (modelIndex <= 1) { damageRecieveSound = "Recieve_duck"; } else { damageRecieveSound = "Recieve_frog"; } GetComponentInChildren <ImpactCollider>().gameObject.layer = LayerMask.NameToLayer("ImpactColl" + playerNumber); worldspaceImg.sprite = availableSprites[playerNumber - 1]; swingPivot = model.swingPivot; punch = model.punch; startingPos = transform.position; cController = GetComponent <CharacterController>(); playerAxisX = "HorizontalP" + playerNumber; playerAxisY = "VerticalP" + playerNumber; playerAxisHit = "HitP" + playerNumber; playerAxisInteract = "Grab-ThrowP" + playerNumber; animator = GetComponentInChildren <Animator>(); currentState = State.idle; groundLayer = LayerMask.GetMask("Ground"); currentGravity = baseGravity; GetAnimationTimes(); AkSoundEngine.SetSwitch("Arma_selector", "Punch", gameObject); }
public override void Init() { equipManager = EquipManager.GetInstance; _playerGFX = GetComponent <PlayerGFX>(); _playerGFX._anim = GetComponent <Animator>(); cameraController = CameraController._instance; inputManager = InputManager._instance; gridManager = GridManager._instance; playerStats = PlayerStats._instance; moveSpeed = playerStats.GetStat(StatType.MoveSpeed); gatheringSpeed = playerStats.GetStat(StatType.GatheringSpeed); scanner = new Scanner(); airRegenCont = new EffectController(playerStats.GetStat(StatType.Air), 2); airRegenData = new EffectData(StatType.Air, EffectType.OverTime, 10f, Mathf.Infinity, 0.5f, false, false); startPositionOfPlayer = base.transform.position; GameManager.DeathEvent += DeathReset; GameManager.RespawnEvent += RespawnReset; }