Ejemplo n.º 1
0
    public void OnPickedUp(CrystalHolder holder)
    {
        // previousHolder = currentHolder;
        currentHolder = holder;
        transform.SetParent(holder.pos, true);
        transform.DOKill();
        var seq = DOTween.Sequence();

        seq.Append(transform.DOLocalMove(Vector3.zero, grabTime));
        seq.Insert(0, transform.DOLocalRotate(Vector3.zero, grabTime));
        // seq.Append(transform.DORotate(new Vector3(0.0f, 90.0f, 0.0f), 0.5f));
    }
Ejemplo n.º 2
0
    public void Swap(CrystalHolder other)
    {
        var a = other.IsAllowedType(this.heldType);
        var b = this.IsAllowedType(other.heldType);

        // Only swap if at least one crystal holder has a crystal
        if (a && b && (this.held || other.held))
        {
            var pickup = other.held;
            other.PickItUp(this.held);
            this.PickItUp(pickup);
        }
    }
    // Start is called before the first frame update
    void Start()
    {
        rigidBody    = GetComponent <Rigidbody>();
        audioSource  = GetComponent <AudioSource>();
        playerHolder = GetComponent <CrystalHolder>();

        jumpSound           = AudioManager.Instance.GetAudioClip("Jump");
        teleportDepartSound = AudioManager.Instance.GetAudioClip("TeleportDepart");
        teleportArriveSound = AudioManager.Instance.GetAudioClip("TeleportArrive");
        respawnSound        = AudioManager.Instance.GetAudioClip("TotemTeleport");

        respawnMaterial  = new Material(respawnMaterial);
        teleportMaterial = new Material(teleportMaterial);
        camoMaterial     = new Material(camoMaterial);

        groundedFrames = new List <bool>(extraJumpFrames);

        for (int i = 0; i < extraJumpFrames; i++)
        {
            groundedFrames.Add(true);
        }
    }
Ejemplo n.º 4
0
 private void Awake()
 {
     myHolder = GetComponent <CrystalHolder>();
 }
Ejemplo n.º 5
0
 private void Start()
 {
     Debug.Assert(currentHolder, "Holder is null. Did you accidentally put a crystal in the scene? Only pedestals should spawn crystals.", this);
     Debug.Assert(type != CrystalType.None, nameof(CrystalType) + " is None. Did you forget to use a prefab variant?", this);
     originalHolder = currentHolder;
 }