Beispiel #1
0
        public override void OnChanged()
        {
            Player player = Main.LocalPlayer;

            if (!player.active)
            {
                return;
            }
            OriPlayer oPlayer = player.GetModPlayer <OriPlayer>();

            oPlayer.SpriteColorPrimary   = playerColor;
            oPlayer.SpriteColorSecondary = playerColorSecondary;
        }
Beispiel #2
0
        /// <summary>
        /// Create an instance of <see cref="Trail"/> that will belong to <paramref name="oPlayer"/>.
        /// </summary>
        /// <param name="oPlayer">The <see cref="OriPlayer"/> this <see cref="Trail"/> will belong to.</param>
        /// <exception cref="ArgumentNullException"><paramref name="oPlayer"/> is <see langword="null"/>.</exception>
        internal Trail(OriPlayer oPlayer)
        {
            if (oPlayer is null)
            {
                throw new ArgumentNullException(nameof(oPlayer));
            }

            _segments = new TrailSegment[Count];
            int i = 0;

            while (i < Count)
            {
                _segments[i++] = new TrailSegment(oPlayer);
            }
        }
Beispiel #3
0
        /// <summary>
        /// Interact with <see cref="OriMod"/> using various inputs.
        /// <list type="table">
        /// <listheader>
        /// <term>Command/Parameters</term>
        /// <description>Description</description>
        /// </listheader>
        /// <item>
        /// <term>"ResetPlayerModData"</term>
        /// <description>
        /// Arguments <see cref="Player"/> -or- <see cref="ModPlayer"/>, resets the <see cref="OriPlayer"/> data on the given <see cref="Player"/>/<see cref="ModPlayer"/> (set-only) —
        /// Returns <see langword="true"/> if arguments are valid; otherwise, <see langword="false"/>.
        /// </description>
        /// </item>
        /// <item>
        /// <term>"IsOri"</term>
        /// <description>
        /// Arguments <see cref="Player"/> -or- <see cref="ModPlayer"/>, checks if the player is in Ori state (readonly) —
        /// Returns <see langword="true"/> if the player is Ori or transforming into Ori; <see langword="false"/> if neither; or <see langword="null"/> if arguments are invalid.
        /// </description>
        /// </item>
        /// </list>
        /// </summary>
        public override object Call(params object[] args)
        {
            int len = args.Length;

            if (len <= 0 || !(args[0] is string cmd))
            {
                return(null);
            }

            OriPlayer oPlayer = null;

            if (len >= 2)
            {
                oPlayer = GetOriPlayer(args[1]);
            }

            switch (cmd)
            {
            case "ResetPlayerModData":
                if (!(oPlayer is null))
                {
                    oPlayer.ResetData();
                    return(true);
                }
                Log.Warn($"{Name}.Call() - ResetPlayerModData - Expected type {typeof(Player)}, got {args[1].GetType()}");
                return(false);

            case "IsOri":
                if (!(oPlayer is null))
                {
                    return(oPlayer.IsOri || oPlayer.Transforming);
                }
                Log.Warn($"{Name}.Call() - Transforming - Expected type {typeof(Player)}, got {args[1].GetType()}");
                return(null);
            }
            return(null);
        }
Beispiel #4
0
 /// <summary>
 /// Creates a <see cref="TrailSegment"/> that belongs to <paramref name="oPlayer"/>.
 /// </summary>
 /// <param name="oPlayer"><see cref="OriPlayer"/> this trail will belong to.</param>
 internal TrailSegment(OriPlayer oPlayer) => _oPlayer = oPlayer;